Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Changes requested: two findings block this as written.
BottomSheetSwitcher.tsx:471adds script Tab containment to switcher steps, but the current records keep those steps on nativeshowModal()containment:component:BottomSheetSwitcherFR5 and DEC-1 (which rejects a script focus trap on top of native containment), andcomponent:DialogDEC-2 andcomponent:BottomSheetFR16, which name the switcher step as the one exception to the shared focus region.- The changeset says the switcher now matches standalone
BottomSheet, but in a step with no tabbable controlspreserveNativeEmptyRegionstill leaves Tab to the browser, while a standalone modal sheet keeps focus on its panel.
The switcher is deprecated, and its documented replacement (one standalone BottomSheet per step) already wraps Tab. If engineering owners decide switcher steps should join the shared focus region, those records need amending first, and this PR would then also update the switcher record, narrow the changeset or drop the empty-step option, and fix the comments that still describe native containment (BottomSheetSwitcher.tsx:474-477, BottomSheetSwitcher.test.tsx:956-958).
| // Native modal dialogs provide this boundary in the browser, but the | ||
| // switcher's host moves between child dialogs during a flow. Keep the same | ||
| // Tab containment as a standalone BottomSheet on every active host. | ||
| useFocusRegionContainment(hostDialogRef, isModal, { |
There was a problem hiding this comment.
This adds script Tab containment to every modal switcher step. component:BottomSheetSwitcher FR5 and DEC-1 keep switcher steps on native showModal() containment (DEC-1 rejects "a script focus trap on top of native containment"). component:Dialog DEC-2 and component:BottomSheet FR16 name the switcher step as the one exception to the shared focus region. Drop this call and the hook option, or have an engineering owner amend those records first.
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] BottomSheetSwitcher now keeps Tab and Shift+Tab inside its active modal sheet, matching standalone BottomSheet. |
There was a problem hiding this comment.
In a step with no tabbable controls, preserveNativeEmptyRegion still leaves Tab to the browser, while a standalone modal BottomSheet cancels the press and keeps focus on its panel. So "matching standalone BottomSheet" does not hold there. Either say "in a step with tabbable controls", or drop the option so empty steps match.
| // Native modal dialogs provide this boundary in the browser, but the | ||
| // switcher's host moves between child dialogs during a flow. Keep the same | ||
| // Tab containment as a standalone BottomSheet on every active host. | ||
| useFocusRegionContainment(hostDialogRef, isModal, { | ||
| preserveNativeEmptyRegion: true, | ||
| }); | ||
| // Focus containment is the native modal dialog's: showModal() makes the | ||
| // page inert, so Tab cannot leave the active sheet. The released read-only | ||
| // `hasActiveFocusTrapEscape()` signal still reports a modal flow as a trap, |
There was a problem hiding this comment.
Non-blocking: the existing comment at 474 still says Tab cannot leave the active sheet because containment is native, which the call above now contradicts. The new comment's reason (the host moving between dialogs) is also not why native containment lets Tab out. A shorter version: "showModal() lets Tab reach the browser's own stops. Wrap it in the active step."
|
I reviewed the requested changes against the current component records before changing this branch. I am leaving the implementation unchanged for now because the review identifies a contract conflict rather than an isolated bug: An engineering owner needs to choose whether deprecated switcher steps should join the shared focus region. If that decision changes the records, I can update the switcher spec, comments, changeset scope, and empty-step behavior together. Until then, changing only the implementation would knowingly violate the current contract. |
Primary intent
Fix #10238 by keeping keyboard focus inside the active modal sheet rendered by BottomSheetSwitcher.
User or maintainer impact
In a modal switcher flow, Tab from the last control and Shift+Tab from the first control could leave the sheet instead of wrapping. Keyboard users could reach the browser chrome or background page before the focus cycle returned.
Authority
Change
Evidence
This is keyboard-focus behavior rather than a visual change, so a screenshot would not reliably demonstrate the fix. The regression test asserts both focus destinations and the prevented key event.
Scope
Components: BottomSheetSwitcher; shared internal focus-region containment hook
Testing
Closes #10238.