[csswg-drafts] [css-ui][proposal] Current scrolling direction pseudoclasses (#6400)

AmeliaBR has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-ui][proposal] Current scrolling direction pseudoclasses ==
A common UI pattern on the web is to hide/show or partially collapse some content based on whether the user is currently scrolling up or down. I'm not particularly fond of this UI pattern, but it is widespread and is often necessary for long pages on mobile screens.

This currently requires JavaScript scroll listeners to change a class on the body or other scroll container in order to trigger the alternate layout of the collapsible headers/footers (and that's assuming it isn't done entirely in JS-framework state propagation!)

Browser-managed scrolling direction pseudoclasses on the scroll container would eliminate the need for many JS scroll listeners. Something like `body:scrolling-forward` vs `body:scrolling-backward` for primary (block) direction scrolling, and some other logical names for cross/inline scrolling. Maybe also some way to distinguish when scrolling has stopped for a while.

Pseudoclasses could also enable browser-managed heuristics for better detecting when the scroll direction has changed (or stopped), based on the device scroll mechanism (touch gesture, keyboard, mouse wheel) or user accessibility customizations. For example, a user with shaky fingers might want to customize how much they need to scroll in a given direction before the layout shifts on them.

(I don't have the capacity to work on this; just throwing it out there in case someone else wants to pick it up!)

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6400 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 21 June 2021 17:03:56 UTC