w3c / pointerevents

Pointer Events
https://w3c.github.io/pointerevents/
Other
68 stars 34 forks source link

Enable mouse click and drag to scroll and other pointer behavior customizations #512

Open flackr opened 3 months ago

flackr commented 3 months ago

I originally mentioned this in https://github.com/w3c/pointerevents/issues/203#issuecomment-819693123 and it was independently requested in https://github.com/w3c/csswg-drafts/issues/9811. There are many interfaces for which clicking and dragging should scroll just like touching down and moving. E.g. a scroll snap carousel-like scrolling element such as https://gui-challenges.web.app/carousel/dist/

For this, I think we should have a way to make mouse click and drag behave as a direct manipulation device. As a strawman example, perhaps we could consider:

/* Defines that all of touch mouse and stylus should be treated as direct manipulation devices. */
pointer-manipulation: touch mouse stylus

It's worth also considering whether the same property should allow for treating the default input behavior in different ways. For example, while stylus is a direct manipulation device, sometimes when touching down and moving near input fields it writes into that input field. We could consider whether such a property should allow for making a stylus still scroll instead of write. E.g. one idea is that pointer-manipulation: auto allows for the UA to do additional actions like allow stylus writing but if you set pointer-manipulation: stylus it must treat it as a manipulation / scroll?

Another request I've heard is allowing for stylus to behave as a mouse, i.e. perform text selection. I'm not sure if the same property could be used or some other convention would be needed.

bramus commented 1 month ago

Big +1 to this request.

I see authors are either resorting to JavaScript right now to map a dragDelta to a scrollOffset (which leads to uncanny situations because you lose native things such as a fling) or simply showing notices on their sites (such as seen here) to notify visitors that they need to scroll instead of drag.