-
Notifications
You must be signed in to change notification settings - Fork 728
Add scroll-direction state and updated overflowing state to scrollable in the explainer #12130
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
Changes from 1 commit
316ff62
a06df07
42fe394
2c2d367
7ef0637
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -147,13 +147,36 @@ a carousel. | |
|
||
- [Author request on github](https://github.com/w3c/csswg-drafts/issues/7430) | ||
|
||
### Overflowing | ||
### Scrollable | ||
|
||
Query whether a container has scrollable overflow. Can be used to indicate | ||
Query whether a container has [scrollable overflow](https://drafts.csswg.org/css-overflow-3/#scrollable-overflow-region). Can be used to indicate | ||
there is content to scroll to in a given direction. | ||
|
||
Needs further exploration. | ||
|
||
### Scroll-direction | ||
|
||
Query based on direction of [scrolling](https://drafts.csswg.org/cssom-view/#scrolling). For instance: | ||
|
||
```css | ||
@container scroll-state(scroll-direction: top) { | ||
.scrolling-up { | ||
translate: 0 0; | ||
} | ||
} | ||
``` | ||
|
||
#### Workaround | ||
|
||
The current workaround solution to style elements based on scroll direction is by using `transition-delay` trick, see | ||
[Solved by CSS Scroll-Driven Animations: hide a header when 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/). However, in this approach, if a user was still pressing on the scrollbar after scrolling to the specific direction the `scroll-direction` would be considered as `none` since the scrollbar wasn't moving anymore. This behaviour is inconsistent with [the completed state of scrolling](https://drafts.csswg.org/cssom-view/#scroll-completed). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This sentence has an assumption about when the scroll direction is updated that is not described in this doc. Nit: "scrolling to the specific direction" -> "scrolling in the specific direction" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added open questions with options about when
tursunova marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#### Use Cases and Author Requests | ||
|
||
To hide/show or partially collapse some content based on the direction of scrolling. | ||
|
||
- [Author request on github](https://github.com/w3c/csswg-drafts/issues/6400) | ||
|
||
### Anchor position fallback | ||
|
||
In earlier exploration of anchor positioning, it was suggested that container | ||
|
@@ -176,6 +199,8 @@ for each state which can be combined with size container types: | |
|
||
- `stuck` | ||
- `snapped` | ||
- `scrollable` | ||
- `scroll-direction` | ||
tursunova marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Query values for `stuck`: | ||
|
||
|
@@ -192,6 +217,43 @@ Query values for `stuck`: | |
Query values for `snapped`: | ||
|
||
- `none` | ||
- `x` | ||
- `y` | ||
- `block` | ||
- `inline` | ||
- `both` | ||
|
||
Query values for `scrollable`: | ||
|
||
- `none` | ||
- `top` | ||
- `right` | ||
- `bottom` | ||
- `left` | ||
- `block-start` | ||
- `inline-start` | ||
- `block-end` | ||
- `inline-end` | ||
- `x` | ||
- `y` | ||
- `block` | ||
- `inline` | ||
|
||
|
||
Query values for `scroll-direction`: | ||
|
||
- `none` | ||
tursunova marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- `any` | ||
tursunova marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- `top` | ||
- `right` | ||
- `bottom` | ||
- `left` | ||
- `block-start` | ||
- `inline-start` | ||
- `block-end` | ||
- `inline-end` | ||
- `x` | ||
- `y` | ||
- `block` | ||
- `inline` | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.