You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bottom Sheet: keyboard users cannot scroll the sheet body (axe serious) #5207
Bug: a keyboard user cannot scroll the Bottom Sheet's content when that content has no focusable elements.
The scrolling area has no tabIndex, so it never takes focus, so arrow keys and Page Down do nothing. A sheet full of plain text is unreachable by keyboard. A sheet with a button inside is fine — focus lands there and scrolls the area.
axe calls this scrollable-region-focusable, severity serious.
How it surfaced. CI's a11y job audits Storybook stories. No Bottom Sheet story had ever rendered open, so nothing was ever checked. A story in PR #5203 did open, and the audit failed immediately. I closed that story to unblock the PR — the bug is older and not from that change.
The fix is not one line. Adding tabIndex={0} to the scroll body adds a tab stop to every sheet, including ones that do not need it. It probably needs to be conditional on the content having no focusable children, which is a runtime check and wants its own review.
Also worth fixing: at least one Bottom Sheet story should render open, or CI will keep missing this whole component.
Files: packages/core/src/BottomSheet/BottomSheetPanel.tsx (the styles.body div).
Proposed approach for the conditional tabIndex, since you flagged this needs its own review rather than a blind one-liner.
BottomSheetPanel.tsx already threads a ref to the scroll body div: bodyElementRef (from useSheetGestures, merged into bodyProps and applied to the styles.body div around line 530). That's the ref to hang the check on rather than adding a new one.
For the focusable-descendant check itself, useFocusTrap.ts already has exactly this logic via FOCUSABLE_SELECTOR (from ../hooks/focusableSelector.ts, module-internal but not barrel-exported, explicitly documented as "shared by focus-management hooks so the selector isn't duplicated"). Since BottomSheetPanel.tsx lives in the same package, it can import it directly rather than reimplementing the selector.
then tabIndex={bodyNeedsTabIndex ? 0 : undefined} on the body div, so a sheet with a real focusable control (the common case) gets no extra tab stop, and a text-only sheet becomes keyboard-focusable and scrollable.
Re-checking on children covers the sheet's own re-render path; it wouldn't catch a focusable element added by some deeper async child after this effect runs without its own re-render bubbling up, but that's the same boundary useFocusTrap's existing focusable-scan has, so it'd be consistent with this codebase's existing precedent rather than a new gap.
On the second point in the issue (no Bottom Sheet story ever renders open, so CI's a11y job never caught this): I'd add that as part of the same PR, an open-by-default story for exactly the "sheet with no focusable content" case, since that's the one this fix targets and the one CI needs actual coverage of going forward.
Let me know if this matches what you had in mind, or if you'd rather see it land differently, before I implement.
Activity
HelloOjasMutreja commentedon Aug 19, 2026
Proposed approach for the conditional tabIndex, since you flagged this needs its own review rather than a blind one-liner.
BottomSheetPanel.tsxalready threads a ref to the scroll body div:bodyElementRef(fromuseSheetGestures, merged intobodyPropsand applied to thestyles.bodydiv around line 530). That's the ref to hang the check on rather than adding a new one.For the focusable-descendant check itself,
useFocusTrap.tsalready has exactly this logic viaFOCUSABLE_SELECTOR(from../hooks/focusableSelector.ts, module-internal but not barrel-exported, explicitly documented as "shared by focus-management hooks so the selector isn't duplicated"). SinceBottomSheetPanel.tsxlives in the same package, it can import it directly rather than reimplementing the selector.Sketch:
then
tabIndex={bodyNeedsTabIndex ? 0 : undefined}on the body div, so a sheet with a real focusable control (the common case) gets no extra tab stop, and a text-only sheet becomes keyboard-focusable and scrollable.Re-checking on
childrencovers the sheet's own re-render path; it wouldn't catch a focusable element added by some deeper async child after this effect runs without its own re-render bubbling up, but that's the same boundaryuseFocusTrap's existing focusable-scan has, so it'd be consistent with this codebase's existing precedent rather than a new gap.On the second point in the issue (no Bottom Sheet story ever renders open, so CI's a11y job never caught this): I'd add that as part of the same PR, an open-by-default story for exactly the "sheet with no focusable content" case, since that's the one this fix targets and the one CI needs actual coverage of going forward.
Let me know if this matches what you had in mind, or if you'd rather see it land differently, before I implement.