Skip to content

spec(Carousel): edge focus moves to the scroll area - #7917

Merged
cixzhang merged 2 commits into
mainfrom
spec/carousel-edge-focus
Oct 22, 2026
Merged

cixzhang merged 2 commits into
mainfrom
spec/carousel-edge-focus

Conversation

@cixzhang

Copy link
Copy Markdown
Contributor

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-085 FR1 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-025 FR12 (current): owns the scroll area's tab stop and naming.
  • family:buttons (current): owns edge button behavior while available.
  • No component:Carousel record exists. Shipped code moves focus to the opposite edge button, falling back to the scroll area, and hides a run-out button.
  • Open PR fix(core): make disabled Button focusable via aria-disabled per AST-085 #7906 makes disabled Buttons focusable (AST-085). Without this record, a hidden run-out edge button would become an invisible tab stop.

Decision

  • A run-out edge scroll button is hidden, takes no tab stop, and is not exposed to assistive technology; it stays mounted. This is removal under AST-085 FR4, not a disabled control (FR1, AR1).
  • When the focused edge button runs out, focus moves to the scroll area without scrolling it (FR2, DEC-1).
  • The handoff happens once per edge transition and only while the edge button held focus (FR3).
  • Everything else about Carousel stays uncontracted.

Rejected alternatives

  • Moving focus to the opposite edge button: it may also be hidden, and focus would jump across the carousel.

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: 0 and native disabled, 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 native disabled. No implementation is included.

Writing rubric results

  • R1 narration: none; present-tense rules only.
  • R2 research in the record: none.
  • R3 evidence naming a change: none; verification names test layers.
  • R4 rejected alternatives over one line or outside a decision: one, one line, in DEC-1.
  • R5 pull request or issue references remaining: none.
  • R6 ruled open questions still listing options: none.

Scope

  • This PR contains specification records only.
  • It records observable behavior and preserves equivalent internal implementations.
  • Any named internal mechanism is intentionally public, names its dependent caller/system, and explains why an equivalent implementation would not satisfy the contract.
  • Verification states the evidence layer and failure signal without prescribing CI job/workflow topology.
  • It records one intentional durable decision, not a rescue for a separable tagalong.
  • The canonical knowledge owner, affected current claims, and overlapping open work are named; any ownership collision is resolved or called out for human decision.
  • Adjacent API, visual, accessibility, composition, and implementation facts remain outside scope unless this exact decision depends on them.
  • Public text and artifacts contain no internal Meta context.

Validation

  • pnpm check:knowledge
  • Prettier
  • git diff --check

@vercel

vercel Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 22, 2026 2:26pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 22, 2026
@astracat-bot

astracat-bot Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 22, 2026, 2:45 PM UTC

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec e8a67ed

@github-actions github-actions Bot added the spec-auto-merge Auto-merge was enabled by the spec owner gate label Oct 22, 2026
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

View Storybook for this PR · View Sandbox for this PR

Current run: The current change has no visual or preview-producing scope. Visual checks are not applicable; preview links are not shown.


Generated by PR Enrichment workflow | View current CI run

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-025 FR12 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.tsx cases still use native disabled and 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 meets spec:AST-025 FR12.

[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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@cixzhang
cixzhang force-pushed the spec/carousel-edge-focus branch from e8a67ed to 37b422b Compare October 22, 2026 14:17
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 37b422b

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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` |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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` |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@cixzhang
cixzhang merged commit 05bfcc5 into main Oct 22, 2026
50 checks passed
@github-actions
github-actions Bot deleted the spec/carousel-edge-focus branch October 23, 2026 06:23

This branch was successfully deployed

1 active deployment
Preview — 37b422bb Deployed Oct 22, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. spec-auto-merge Auto-merge was enabled by the spec owner gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant