Repository navigation
fix(Carousel): the scroll area is a named group, a tab stop only while it overflows #8155
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 all commits
dc7c557
a0bfe28
3952ca7
9ce4e0e
a2184a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] Carousel's scroll area is a group named like the carousel, so a screen-reader user who tabs onto it hears where they are. It is a tab stop only while its content overflows; a carousel that fits no longer adds an empty stop. | ||
|
|
||
| @vjeux |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] `useScrollOverflow` measures again when the container's content changes with the container keeping its size: a child added, removed or resized, or a new gap or padding. Carousel's scroll area, a tab stop only while its content overflows, and its edge buttons and fades follow slides added or removed and a slide that grows; TabList's fades follow its tabs the same way. | ||
|
|
||
| @vjeux |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,9 @@ | |
| * scroll control. Exposes APG | ||
| * carousel semantics: the root is a labelled region with | ||
| * aria-roledescription="carousel" and each item wrapper is a group with | ||
| * aria-roledescription="slide" named "Slide N of M". | ||
| * aria-roledescription="slide" named "Slide N of M". The scroll area is a | ||
| * group named like the carousel and a tab stop only while its content | ||
| * overflows (AST-025 FR12). | ||
| * | ||
| * SYNC: When modified, update: | ||
| * - /packages/core/src/Carousel/index.ts (exports) | ||
|
|
@@ -591,7 +593,13 @@ export function Carousel({ | |
| aria-roledescription="carousel"> | ||
| <div | ||
| ref={composedRef} | ||
| tabIndex={0} | ||
| // The scroll area takes keyboard scrolling (spec:AST-025 FR12): a | ||
| // group named like the carousel, in the tab order only while its | ||
| // content overflows. While it fits it still takes focus | ||
| // programmatically, for the edge buttons' hand-off (FR2). | ||
| role="group" | ||
| aria-label={ariaLabel} | ||
| tabIndex={hasOverflow ? 0 : -1} | ||
|
Contributor
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.
Contributor
Author
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. Fixed in a2184a1: |
||
| onWheel={handleWheel} | ||
| {...mergeProps( | ||
| themeProps('carousel-scroller', { | ||
|
|
||
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.
hasOverflowcomes fromuseScrollOverflow, which re-measures only on this element's ownscrollevents and own-box resize. Slides appended after mount inside an unchanged box (a one-slide-per-view carousel fed by async data) never flip it: in Chromium, 1280px of content in a 320px area stays attabindex="-1"with both edge buttons hidden, so Tab skips the carousel and the arrow keys never reach it, where the base kept a reachable stop.spec:AST-025FR12 requires overflowing content to stay keyboard reachable and leaves geometry to FR5 ("A viewport-onlyResizeObserveris insufficient because content may grow while the viewport's own box remains unchanged"). Re-measuring when the slides change (or reading the shareduseScrollableAreameasurement) while keeping-1for the fitting case would close it; a test that rerenders with more slides and a widerscrollWidthwithout firingscrollwould pin it.