-
Notifications
You must be signed in to change notification settings - Fork 22.6k
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
Editorial review: Document CSS carousel functionality #38752
base: main
Are you sure you want to change the base?
Conversation
Preview URLs (10 pages)
Flaws (14)Note! 3 documents with no flaws that don't need to be listed. 🎉 URL:
URL:
URL:
URL:
URL:
URL:
URL:
External URLs (7)URL:
URL:
URL:
URL:
URL:
URL:
URL:
(comment last updated: 2025-03-26 10:05:58) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
excellent work as always!
left a few notes and some tips 🙂
|
||
A scroll container's **`::scroll-marker-group`** pseudo-element automatically contains any {{cssxref("::scroll-marker")}} pseudo-elements generated on its descendants. This allows them to be positioned and laid out as a group, and is typically used when creating a CSS carousel, to create a scroll position indicator. The individual scroll markers can also be used to navigate to their associated content items. | ||
|
||
The {{cssxref("scroll-marker-group")}} property must be set to a non-`none` value on the scroll container for a `::scroll-marker-group` pseudo-element to be generated; the chosen value determines whether it is generated `before` or `after` the container's DOM content. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The {{cssxref("scroll-marker-group")}} property must be set to a non-`none` value on the scroll container for a `::scroll-marker-group` pseudo-element to be generated; the chosen value determines whether it is generated `before` or `after` the container's DOM content. | |
The {{cssxref("scroll-marker-group")}} property must be set to a non-`none` value on the scroll container for a `::scroll-marker-group` pseudo-element to be generated; the chosen value determines whether it is generated `before` or `after` the container's DOM content. A choice of `before` puts the marker group first in the carousel tab order, while `after` puts the markers at the end of the carousel tab order. |
noting how this choice affects the focus order
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I didn't know this — useful, thanks!
I've added the following at the end of the paragraph:
It also affects where the scroll marker group appears in the container's tab order —
before
puts it at the start, whileafter
puts it at the end.
Am I correct about the choice affecting where the pseudo-elements are generated? This is what the spec seems to be saying, although Chrome doesn't actually seem to do this (it always seems to put the generated pseudo-element before).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've also added the information on tab order to the scroll-marker-group
property page, and the CSS carousels guide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i've got clarification, it affects both focus order and layout box order but not dom structure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks for clarifying; I have updated the descriptions of the scroll-marker-group
property value effects to suit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i reviewed part of this PR.
We need the most basic possible example for the guide, and then we need to walk users through the enhancement from this is an scroll container that overflows to this is a basic carousel.
then we can add that basic example to each property page, then demonstrate updates to that feature only on each page, and link to the guide for the "to see how the rest of this demo worked".
a lot needs to be reworked, so pausing my review here. I'll try creating some codepens for you to help you out.
|
||
## See also | ||
|
||
- {{cssxref("scroll-marker-group")}} and {{cssxref("interactivity")}} properties |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
broken link
|
||
{{CSSRef}} | ||
|
||
The **`:target-current`** [CSS](/en-US/docs/Web/CSS) [pseudo-class](/en-US/docs/Web/CSS/Pseudo-classes) selects the {{cssxref("::scroll-marker")}} pseudo-element of a {{cssxref("scroll-marker-group")}} that is currently scrolled to, in other words, the **active** scroll marker. This can be used to style it differently, so the user can see see their navigation position inside the scroll marker group. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest putting the word being defined before its definition.
The **`:target-current`** [CSS](/en-US/docs/Web/CSS) [pseudo-class](/en-US/docs/Web/CSS/Pseudo-classes) selects the {{cssxref("::scroll-marker")}} pseudo-element of a {{cssxref("scroll-marker-group")}} that is currently scrolled to, in other words, the **active** scroll marker. This can be used to style it differently, so the user can see see their navigation position inside the scroll marker group. | |
The **`:target-current`** [CSS](/en-US/docs/Web/CSS) [pseudo-class](/en-US/docs/Web/CSS/Pseudo-classes) selects the **active** scroll marker, the {{cssxref("::scroll-marker")}} pseudo-element of a {{cssxref("scroll-marker-group")}} that is currently scrolled to. This [selector](/en-US/docs/Web/CSS/CSS_selectors) can be used to style the active navigation position within a [scroll marker group](). |
or possibly something like
This [selector](/en-US/docs/Web/CSS/CSS_selectors) enables providing active styles to the current navigation position within a [scroll marker group](), which improves user experience.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the selector is not valid on anything other than ::scroll-marker
, we should say that (in case anyone thinks it might also be related to :target
).
|
||
## Examples | ||
|
||
See [Creating CSS carousels](/en-US/docs/Web/CSS/CSS_overflow/CSS_carousels) for full examples that use the `:target-current` pseudo-class. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See [Creating CSS carousels](/en-US/docs/Web/CSS/CSS_overflow/CSS_carousels) for full examples that use the `:target-current` pseudo-class. | |
See [Creating CSS carousels](/en-US/docs/Web/CSS/CSS_overflow/CSS_carousels#first_example) for examples of using the `:target-current` pseudo-class. |
::scroll-marker:target-current { | ||
background-color: black; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
::scroll-marker:target-current { | |
background-color: black; | |
} | |
::scroll-marker { | |
color: black; | |
background-color: white; | |
} | |
::scroll-marker:target-current { | |
color: white; | |
background-color: black; | |
} |
|
||
## See also | ||
|
||
- {{cssxref("scroll-marker-group")}} and {{cssxref("interactivity")}} properties |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- {{cssxref("scroll-marker-group")}} and {{cssxref("interactivity")}} properties | |
- {{cssxref("scroll-marker-group")}} | |
- {{cssxref("theOtherThing")}} |
|
||
## First example layout with flexbox | ||
|
||
In the first example, the unordered list is given a {{cssxref("width")}} of `100vw` to force it to the full width of the viewport, a {{cssxref("height")}} of `300px`, and `20px` of {{cssxref("padding")}}. We then give it a {{cssxref("display")}} value of `flex` to force the child list items to display horizontally, and a {{cssxref("gap")}} of `4vw` between each one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the first example, the unordered list is given a {{cssxref("width")}} of `100vw` to force it to the full width of the viewport, a {{cssxref("height")}} of `300px`, and `20px` of {{cssxref("padding")}}. We then give it a {{cssxref("display")}} value of `flex` to force the child list items to display horizontally, and a {{cssxref("gap")}} of `4vw` between each one. | |
The unordered list is made to fill the full width of the viewport, with a {{cssxref("height")}} of `300px` and some {{cssxref("padding")}}. We set the {{cssxref("display")}} to`flex`, defaulting the {{cssxref("flex-direction")}} `row` and the {{cssxref("flex-wrap")}} to `no-wrap`, and add a {{cssxref("gap")}} between each item. As the viewport is wider than our now horizontal row of flex-items, the `<ul>` will be a {{glossary("scroll container")}}. |
Stop this section at this point, and show the demo, and suggest they scroll left and right,. We conclude "flex layout" before movin on.
border: 1px solid #ddd; | ||
padding: 20px; | ||
|
||
flex: 0 0 calc(100vw - 40px); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needlessly complex. does 100% work? or 96vw which is the width minus the gap?
list-style-type: none; | ||
background-color: #eee; | ||
border: 1px solid #ddd; | ||
padding: 20px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move the basic stuff to the first section. and the flex to the flexlayout section.
is the snap necessary? If yes, explain what it does, how it works, and demo it with guidance to test it out here and links to learn more.
if it's not necessary for carousels, add it after the carousel works in a rudimentary way as an enhancement.
either way, scroll snapping should be under it's own subheader with no other features explained in that part.
} | ||
``` | ||
|
||
## Setting inertness on non-visible articles |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this section.
inertness is not ready yet. The links are broken. And, this is an advanced topic that should come after the carouself is otherwise working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this section is NOT reviewed.
``` | ||
|
||
## Creating the scroll buttons | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to explain why we are doing this and progress this guide in an order that teaches the features by enhancing the demo step by step. Add someone like "What we have now is a horizontal row of items, made up of individual flex items, with only one item visible at a time. We have to scroll to see the next item . The features defined in the ...." here, then go on.
I think it makes more sense to start with group and markers before left and right. but maybe there's a reason to go in this order.
I am working on a codepen for you. see https://codepen.io/estelle/pen/ByaOveM. it contains the steps to add in the order to add them for the guide to progress in a way that will make sense to people learning these features for the first time. |
This pull request has merge conflicts that must be resolved before it can be merged. |
Description
Chrome 135 supports the new CSS carousel functionality — see the following ChromeStatus entries:
This PR aims to document all the new functionality. Specifically, it adds:
::scroll-button()
ref pagescroll-marker-group
ref page::scroll-marker-group
ref page::scroll-marker
ref page:target-current
ref page::column
ref pageMotivation
Additional details
Related issues and pull requests