Repository navigation
spec(Carousel): edge focus moves to the scroll area - #7917
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec e8a67ed |
PR Analysis ReportView Storybook for this PR · View Sandbox for this PR
Generated by PR Enrichment workflow | View current CI run |
There was a problem hiding this comment.
Requesting changes on the new Carousel record: the owner-approved direction stands, but three record edits are needed before it becomes the governing contract, and the new head will need a fresh /approve-spec.
- DEC-1 calls the scroll area an always-present tab stop, but
spec:AST-025FR12 adds it to the tab order only while it overflows, so the "Content shrinks to fit" handoff needs an explicit target, such as the scroll area taking focus outside the tab order. - Compatibility/readiness should say that shipped Carousel and the listed
Carousel.test.tsxcases still use nativedisabledand the opposite-button handoff, pending conformance. - End-user impact should note that the scroll area has no role or name today (
Carousel.a11y.known-failures.ts), so screen-reader users lose the announced destination until it meetsspec:AST-025FR12.
[Automated review]
|
|
||
| Carousel hides an edge button whose direction has run out, so keeping focus on | ||
| it would leave a keyboard user on an invisible control. The scroll area is the | ||
| region's own tab stop and is always present, so focus moving there keeps the |
There was a problem hiding this comment.
spec:AST-025 FR12, which this record names as the owner of the scroll area's tab stop, adds a keyboard-scrolling viewport to the tab order only while it overflows. So the scroll area is not always a tab stop: in the "Content shrinks to fit" state (line 94) it has none, and unless it stays focusable outside the tab order, focusing it there leaves focus on the page body. Consider saying the scroll area takes focus in that state even while it is out of the tab order (FR13 already lets a focused viewport keep focus), or naming another in-region target, and dropping "always present".
| | Behavior | An edge scroll button whose direction has run out is hidden and takes no tab stop. When the focused edge button runs out, focus moves to the scroll area. | | ||
| | End-user impact | A keyboard user who scrolls to the first or last item stays inside the carousel instead of landing on the page body or on an invisible control. | | ||
| | Builder impact | None. | | ||
| | Compatibility/readiness | No API change. Focus at the edge moves to the scroll area rather than the opposite button. | |
There was a problem hiding this comment.
The template asks this cell for the implementation state and any evidence still pending. Shipped Carousel still renders run-out buttons with native disabled, which keeps them in the accessibility tree, and hands focus to the opposite button; Carousel.test.tsx, listed in verified_by, asserts both. Saying they are pending conformance, as family:buttons does for spec:AST-085, keeps this current record from reading as already implemented.
| | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | Public contract | None changes. | | ||
| | Behavior | An edge scroll button whose direction has run out is hidden and takes no tab stop. When the focused edge button runs out, focus moves to the scroll area. | | ||
| | End-user impact | A keyboard user who scrolls to the first or last item stays inside the carousel instead of landing on the page body or on an invisible control. | |
There was a problem hiding this comment.
Shipped code already keeps focus inside the carousel, on the opposite button. What gets worse for screen-reader users is the destination: the scroll container is exposed with no role or name today (Carousel.a11y.known-failures.ts), so they hear nothing about where they landed until it meets spec:AST-025 FR12. Worth stating here and in Compatibility/readiness.
|
|
||
| | Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior | | ||
| | ------------------ | ----------------------- | -------------------------------------------------- | ----------------------------------------- | ------- | -------------------- | --------- | ---------------------- | | ||
| | Edge scroll button | available, run out | Whether content remains in that button's direction | Both edges when the carousel overflows | — | `component:Carousel` | stable | not applicable | |
There was a problem hiding this comment.
With hasLoop the buttons stay visible at both edges, but this definition together with FR1 reads as hiding them at the end. Defining run out as "no scroll is available in that direction", or moving "Loop keeps both enabled" from the Mid-scroll row to the edge rows, would remove the ambiguity. Not blocking.
e8a67ed to
37b422b
Compare
|
/approve-spec 37b422b |
There was a problem hiding this comment.
Approving the new Carousel record: the owner-approved direction is consistent with the focusable-disabled and scroll-container specs, and this head makes the three edits requested on the previous one. Three optional wording fixes would help the conformance work that follows:
- Add "content shrinks to fit while an edge button is focused" to the FR2 verification row, since FR2 now covers that state.
- Word the FR3 failure signal as "focus moving while no edge button held focus", so it does not reject the fit-state handoff.
- Define run out as "no scroll is available in that direction", or move "Loop keeps both enabled" to the edge rows, so looping buttons do not read as hidden.
Open #7906 still hands focus to the opposite button, so whichever of the two lands second should switch that handoff to the scroll area.
[Automated review]
| | Contract | Verification | Representative states | Mutation or failure expectation | Audit section | | ||
| | -------- | --------------------------------------- | -------------------------------------------------------- | ------------------------------------------------------------------------------ | ------------------------------ | | ||
| | FR1, AR1 | Unit and accessibility-tree tests | at rest at each edge; no overflow | A hidden button that is focusable or exposed fails | `audit:Carousel/accessibility` | | ||
| | FR2, AR2 | Real-browser keyboard test | Enter on "Scroll right" until the end; same on the start | Focus on the page body, a hidden button, or the opposite button fails | `audit:Carousel/accessibility` | |
There was a problem hiding this comment.
FR2 now covers the fit state ("This holds when the content no longer overflows and the scroll area is out of the tab order", line 83), and Representative states lists "Content shrinks to fit" (line 94), but this row only exercises pressing to an edge. Adding "content shrinks to fit while an edge button is focused" here keeps conformance tests from skipping the one state that needs the scroll area focusable outside the tab order. Not blocking.
| | -------- | --------------------------------------- | -------------------------------------------------------- | ------------------------------------------------------------------------------ | ------------------------------ | | ||
| | FR1, AR1 | Unit and accessibility-tree tests | at rest at each edge; no overflow | A hidden button that is focusable or exposed fails | `audit:Carousel/accessibility` | | ||
| | FR2, AR2 | Real-browser keyboard test | Enter on "Scroll right" until the end; same on the start | Focus on the page body, a hidden button, or the opposite button fails | `audit:Carousel/accessibility` | | ||
| | FR3 | Real-browser test with swipe and resize | edge reached with focus outside the carousel | Focus moving without an edge-button press, or moving twice for one edge, fails | `audit:Carousel/accessibility` | |
There was a problem hiding this comment.
FR3 scopes the handoff to "while the edge button held focus" (line 84), and the fit-state handoff happens with no press at all, but this failure signal rejects "Focus moving without an edge-button press". Suggest: "Focus moving while no edge button held focus, or moving twice for one edge, fails." Not blocking.
Exact decision needed
Where keyboard focus goes when the focused Carousel edge scroll button runs out of content in its direction.
Existing authority searched
spec:AST-085FR1 and FR4 (current): disabled controls stay focusable; a component may name a focus destination for a control it removes, in its own record.spec:AST-025FR12 (current): owns the scroll area's tab stop and naming.family:buttons(current): owns edge button behavior while available.component:Carouselrecord exists. Shipped code moves focus to the opposite edge button, falling back to the scroll area, and hides a run-out button.Decision
Rejected alternatives
Claim scope and non-goals
Only edge button visibility, tab order, and the edge focus destination. Scrolling, looping, snapping, fades, and slide semantics are out of scope.
Evidence and implementation relationship
Current source hides run-out edge buttons with
opacity: 0and nativedisabled, and hands focus to the opposite button. Conformance aligns the handoff to the scroll area and keeps hidden buttons out of the tab order once Button stops using nativedisabled. No implementation is included.Writing rubric results
Scope
Validation
pnpm check:knowledgegit diff --check