-
Notifications
You must be signed in to change notification settings - Fork 676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-ui-4] pointer-events should have a filtering capability #6280
Comments
I believe Therefore, it somewhat makes sense to me to extend that property to filter the events it handles. An important question is how fine-grained the control should be that authors have over events. E.g. does it make sense to allow hover events, pass through move events and stop any other events? Do people want to pass through pointer down events but stop pointer up events? Sebastian |
As a web developer, my use case is a simple css scroll snap carousel with left/right buttons on desktop. (Example: https://snap.glitch.me/carousel.html) If the user is hovering over the left/right buttons while attempting to scroll, it doesn't scroll the carousel. (This is worse if the buttons are touch friendly/bigger.) Even worse, on horizontal scroll views on a Mac, this causes horizontal scroll to be redirected to the document root which causes the browser to navigate (forward/back). Workarounds I've tried:
At this point, there's no good solution. This is made worse by there being no way to determine if the user is interacting with a touchpad or via a mouse - so I can't just remove the buttons if the user has a touchpad. Solution
Thank you for your consideration. |
This is a admittedly somewhat niche requirement I ran into quite a few times:
However, this also poses the immediate question of what happens when such an element itself is overflowing and should become scrollable. Then, you'd need to have a mechanism that only applies when the element doesn't even fire that event itself and that would make for an extremely confusion user experience. In terms of API shape, a simple keyword wouldn't cut it. One would need a sort of filtering mechanism in both directions:
|
@kleinfreund I think you're asking for |
@tabatkins Apologies, I somehow managed to completely invert the requirements I had in mind while writing them down. I updated my post and also expanded the explanation somewhat. My intention was to achieve the inverse effect: to allow a scroll on a card to "chain up" (or "through") the card and fire on the element behind it. Most likely this one of these cases where in isolation, such an API could make sense, but overall, it's probably too big of a UX infraction if not handled extremely carefully should the card itself need to have any scrolling content. |
Once #4438 has the currently implemented version of
pointer-events
added to css-ui, we should take a look at the feature requests in https://wiki.mozilla.org/SVG:Pointer-events and our own issue list. One item on the Mozilla wiki isThere is also a request in #4499 to have a value that just stops events (instead of passing them through). I think it would be useful to combine these ideas and allow a CSS declaration that declares which events are handled, which are passed through, and which are stopped.
The particular case that led me to opening this issue is an overlay where we want it to respond to hover events, but have click events pass through to the element underneath.
The text was updated successfully, but these errors were encountered: