Description
MDN URL
https://developer.mozilla.org/en-US/docs/Web/API/DragEvent
What specific section or headline is this issue about?
Event Types | dragover
What information was incorrect, unhelpful, or incomplete?
In the DragEvent page, the ondragover event timing is written as "50 ms [or sometimes 1-5 ms]":
https://developer.mozilla.org/en-US/docs/Web/API/DragEvent
dragover This event is fired continuously when an element or text selection is being dragged and the mouse pointer is over a valid drop target (every 50 ms WHEN mouse is not moving ELSE much faster between 5 ms (slow movement) and 1ms (fast movement) approximately. This firing pattern is different than mouseover ).
In the dragover event page, the timing is written as "every few hundred milliseconds":
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dragover_event
The dragover event is fired when an element or text selection is being dragged over a valid drop target (every few hundred milliseconds).
In the HTML Drag and Drop API page, the timing is written as "every few hundred milliseconds": https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API#drag_events
dragover ...a dragged item is being dragged over a valid drop target, every few hundred milliseconds.
In the whatwg dragover event specification, the event loop is specified to run "every 350ms (±200ms)" with step 3. in the loop being the dragover event firing:
https://html.spec.whatwg.org/multipage/dnd.html#event-dnd-dragover
User agents must, as soon as the drag operation is initiated and every 350ms (±200ms) thereafter for as long as the drag operation is ongoing, queue a task to perform the following steps in sequence: ... 3. If the current target element is a DOM element, then fire a DND event named dragover at this current target element.
This information seems to have been introduced in commit "initial en-us content checkin" in 2020: https://github.com/mdn/content/blame/5bc689d5fe026fd0cd5e45f50222a07426d04a09/files/en-us/web/api/dragevent/index.md#L45
What did you expect to see?
Same timing information across MDN pages and whatwg spec, or if there is a difference between typical implementations and the whatwg spec, a note about that in the MDN pages.
Do you have any supporting links, references, or citations?
See "What information was incorrect, unhelpful, or incomplete?" section above for inline links to references.
Do you have anything more you want to share?
I did a quick test with the following code (Chrome, Safari, Firefox on macOS; Chrome, Firefox on Linux), and saw values in the range 0...50, with the exception of Firefox on Linux where the event does not fire if the mouse is stationary (this seems like a bug).
let lastDragTime = 0;
document.ondragover = ((e) => {
console.log(performance.now() - lastDragTime);
lastDragTime = performance.now();
});
This seems to match closest with the statement "every 50 ms WHEN mouse is not moving ELSE much faster between 5 ms (slow movement) and 1ms (fast movement) approximately" found in https://developer.mozilla.org/en-US/docs/Web/API/DragEvent
Based on this test information, I think it would make most sense to update the information in the dragover event page to match the note in the DragEvent page, and to add an additional note that typical browser timing behavior is different from the spec. However, I would really like some extra eyes on whether I read the spec correctly, since I could be interpreting it wrong.
Thank you!
MDN metadata
- Folder:
en-us/web/api/dragevent - MDN URL: https://developer.mozilla.org/en-US/docs/Web/API/DragEvent
- GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/web/api/dragevent/index.md
- Last commit: https://github.com/mdn/content/commit/a4675b9077ae32f989c7ecac94f454db2653c4fc
- Document last modified: 2024-07-25T22:06:52.000Z