You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add scroll-direction state and updated overflowing state to scrollable in the explainer (#12130)
* Add scroll-direction state and updated owerflowing state to scrollable
* Applied review comments
* Specified recent/active scroll-direction state, renamed to
* Modified open questions
* Applied review comments
Copy file name to clipboardExpand all lines: css-conditional-5/scroll_state_explainer.md
+79-4Lines changed: 79 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -147,12 +147,51 @@ a carousel.
147
147
148
148
-[Author request on github](https://github.com/w3c/csswg-drafts/issues/7430)
149
149
150
-
### Overflowing
150
+
### Scrollable
151
151
152
-
Query whether a container has scrollable overflow. Can be used to indicate
153
-
there is content to scroll to in a given direction.
152
+
Query whether a container has [scrollable overflow](https://drafts.csswg.org/css-overflow-3/#scrollable-overflow-region).
153
+
Can be used to indicate there is content to scroll to in a given direction.
154
154
155
-
Needs further exploration.
155
+
### Direction
156
+
157
+
Query the most recent direction of [scrolling](https://drafts.csswg.org/cssom-view/#scrolling).
158
+
For instance:
159
+
160
+
```css
161
+
@container scroll-state(direction: top) {
162
+
.scrolling-up {
163
+
translate: 00;
164
+
}
165
+
}
166
+
```
167
+
168
+
#### Workaround
169
+
170
+
A workaround solution to create queries based on scrolling direction is
171
+
described in [Solved by CSS Scroll-Driven Animations: hide a header when
172
+
scrolling down, show it again when scrolling up](https://www.bram.us/2024/09/29/solved-by-css-scroll-driven-animations-hide-a-header-when-scrolling-up-show-it-again-when-scrolling-down/),
173
+
uses a `transition-delay` trick to get the active scroll direction.
174
+
175
+
#### Use Cases and Author Requests
176
+
177
+
To hide/show or partially collapse some content based on the direction of
178
+
scrolling.
179
+
180
+
-[Author request on github](https://github.com/w3c/csswg-drafts/issues/6400)
181
+
182
+
#### Active scroll direction
183
+
184
+
The proposed `direction` feature matches the state of the most recent
185
+
scroll direction. Web authors might also want to create queries based on the
186
+
current scroll direction, not only the most recent one, similar to [scrollend
0 commit comments