Skip to content

Commit 8392df9

Browse files
authored
Rename direction to scrolled, updated explainer (#12881)
1 parent e1989ba commit 8392df9

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

css-conditional-5/Overview.bs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,18 +1589,18 @@ Scrollable: the '@container/scrollable' feature</h4>
15891589
The [=scroll container=] has [=scrollable overflow=] in its inline direction.
15901590
</dl>
15911591

1592-
<h4 id="direction">
1593-
Direction: the '@container/direction' feature</h4>
1592+
<h4 id="scrolled">
1593+
Scrolled: the '@container/scrolled' feature</h4>
15941594

15951595
<pre class="descdef mq">
1596-
Name: direction
1596+
Name: scrolled
15971597
For: @container
15981598
Value: none | top | right | bottom | left | block-start | inline-start | block-end | inline-end | x | y | block | inline
15991599
Type: discrete
16001600
</pre>
16011601

16021602
For a [=query container=] that is a [=scroll container=],
1603-
the '@container/direction' [=container feature=] queries the direction of its most recent [=relative scroll=].
1603+
the '@container/scrolled' [=container feature=] queries the direction of its most recent [=relative scroll=].
16041604
The logical values map to physical based on the direction and writing-mode of the [=query container=].
16051605
None of the values match if the container is not a [=scroll container=].
16061606

css-conditional-5/scroll_state_explainer.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,13 @@ a carousel.
152152
Query whether a container has [scrollable overflow](https://drafts.csswg.org/css-overflow-3/#scrollable-overflow-region).
153153
Can be used to indicate there is content to scroll to in a given direction.
154154

155-
### Direction
155+
### Scrolled
156156

157-
Query the most recent direction of [scrolling](https://drafts.csswg.org/cssom-view/#scrolling).
157+
Query the direction of [the most recent relative scroll](https://drafts.csswg.org/css-scroll-snap-1/#scroll-types).
158158
For instance:
159159

160160
```css
161-
@container scroll-state(direction: top) {
161+
@container scroll-state(scrolled: top) {
162162
.scrolling-up {
163163
translate: 0 0;
164164
}
@@ -167,8 +167,8 @@ For instance:
167167

168168
#### Workaround
169169

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
170+
A workaround solution to create queries based on scrolling direction
171+
is described in [Solved by CSS Scroll-Driven Animations: hide a header when
172172
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/),
173173
uses a `transition-delay` trick to get the active scroll direction.
174174

@@ -181,10 +181,11 @@ scrolling.
181181

182182
#### Active scroll direction
183183

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
187-
event](https://drafts.csswg.org/cssom-view/#eventdef-document-scrollend).
184+
The proposed `scrolled` feature
185+
matches the state of the most recent relative scroll direction.
186+
Web authors might also want to create queries
187+
based on the active scroll direction, not only the most recent one,
188+
similar to [scrollend event](https://drafts.csswg.org/cssom-view/#eventdef-document-scrollend).
188189

189190
This needs further discussion with the working group.
190191

0 commit comments

Comments
 (0)