Repository navigation
fix(a11y): trap keyboard focus in remaining top-level dialogs - #1255
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3bab92a2b9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| }, [onClose, pending]); | ||
|
|
||
| useEscapeClose(true, handleClose); | ||
| useModalFocus(true, dialogRef); |
There was a problem hiding this comment.
Make the nested focus traps stack-aware
When a first-run user reaches the onboarding Setup step and clicks Add project, App.handleAddProject only sets addPathOpen, so OnboardingModal remains mounted while this call installs a second document-level useModalFocus trap. Both hooks redirect every focusin outside their own root; focusing an add-project input therefore bounces focus between the two dialogs recursively, while Tab remains trapped in the onboarding dialog, making this supported add-project flow keyboard-inoperable. Suspend the onboarding trap while the child dialog is open, close onboarding before opening it, or make useModalFocus manage a topmost-modal stack.
Useful? React with 👍 / 👎.
Leftover from #916 / #920. This thread's worktree could not land: it was a 134-commit diverged fork. This PR is that leftover replayed onto current
main.useModalFocuson:Each dialog gets a ref,
tabIndex={-1}, initial focus, Tab cycling, and restore on close. Copy and save/submit logic are unchanged.Mounted tests: opening each dialog moves
document.activeElementinside it, and Tab stays inside.