web icon indicating copy to clipboard operation
web copied to clipboard

Add mouse*, drag* and touch* events to Window and Document events stream helper extensions

Open fsw opened this issue 1 month ago • 1 comments

According to MDN mouse* and drag* events bubble up to Document and Window:

https://developer.mozilla.org/en-US/docs/Web/API/Window#bubbled_events https://developer.mozilla.org/en-US/docs/Web/API/Document#bubbled_events

Also code like this was working with dart:html:

document.onMouseMove.listen(handler);
document.onDragEnd.listen(handler);

I am not sure about the touch* events. MDN does not list those events for Document and Window but on the other hand they do bubble (at least in Firefox 145.0.* and Chrome 142.0.*). Also onTouchMove was already added in WindowEventGetters and those events were also working with dart:html. So maybe those should be added but to WindowCustomEvents and DocumentCustomEvents extensions instead?


  • [x] I’ve reviewed the contributor guide and applied the relevant portions to this PR.

fsw avatar Nov 24 '25 12:11 fsw

Thoughts @srujzs

At a minimum @fsw we'll want a changelog entry here!

kevmoo avatar Nov 24 '25 18:11 kevmoo

I am not sure about the touch* events. MDN does not list those events for Document and Window but on the other hand they do bubble (at least in Firefox 145.0.* and Chrome 142.0.*). Also onTouchMove was already added in WindowEventGetters and those events were also working with dart:html. So maybe those should be added but to WindowCustomEvents and DocumentCustomEvents extensions instead?

Yeah, some of the touch events don't really exist afaict (e.g. touchleave). It's possible they were removed at some point from the spec, but for parity with dart:html, keeping those is reasonable. WindowCustomEvents was really meant for the events that required some additional, custom checks. That doesn't apply here, so putting the added events in WindowEventGetters and DocumentEventGetters is fine.

srujzs avatar Dec 08 '25 20:12 srujzs