-
Notifications
You must be signed in to change notification settings - Fork 759
Description
The Problem
When creating dropzones to drag&drop things like files to, it is very common for web developers to listen to the drag-related HTML events (dragenter, dragleave...) to update the element's styles to indicate "You can drop this here!".
This seems like the job for a CSS selector.
Why?
Having a selector that just does this (similar to the :hover selector) would be a very nice authoring convenience and probably also more robust in circumstances where the expected events might not fire.
Think: Does dragleave fire if the mouse leaves the window? if the element becomes inert? if it is removed?
Authors would not need to think about these details anymore, simplifying the process of setting this up.
It would also mean that styling drop areas can now be done with CSS only, which seems cleaner than having to register event listeners for it from JavaScript.
Considerations
This should probably be mutually exclusive with the :hover selector itself since, at least in Firefox and Chrome, regular hovering does not happen during dragging of stuff.
I am not particularly invested in calling it :hover-drag, that's just the best I could come up with, maybe next to :drag-target. (although that one looks less like a hover equivalent for dragging)
Since I think this would need spec changes both here and in HTML, I've also opened this request on the HTML Github:
whatwg/html#11104
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Status