Repository navigation
fix(desktop): enable modal focus trap on v1 + v2 workspace dialogs - #3392
Conversation
Applies the same fix as #3276 to both v1 (NewWorkspaceModal) and v2 (DashboardNewWorkspaceModal) Dialogs so alt-tabbing back restores focus to the modal.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughBoth workspace modal components now pass the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR applies the focus-trap fix from #3276 to both the v1 (
Confidence Score: 4/5Safe to merge — the focus-trap fix is correct and well-targeted; one pre-existing structural inconsistency worth cleaning up. The core change (adding Both changed files share the same Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant OS as OS/Window Manager
participant Radix as Radix Dialog (modal=true)
participant Input as Prompt Input
User->>Radix: Open workspace modal
Radix->>Input: Auto-focus prompt input
User->>OS: Alt-Tab away (window blur)
OS-->>Radix: Window loses focus
User->>OS: Alt-Tab back (window focus)
OS-->>Radix: Window regains focus
Radix->>Input: Restore focus (focus trap active)
Note over Radix,Input: onFocusOutside prevents<br/>focus escaping the modal
User->>Radix: Click overlay
Radix->>Radix: onOpenChange(false) → closeModal()
User->>Radix: Press Escape
Radix->>Radix: onOpenChange(false) → closeModal()
|
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
…aradevAI#3392) * fix(desktop): enable modal focus trap on v1 + v2 workspace dialogs Applies the same fix as ParadevAI#3276 to both v1 (NewWorkspaceModal) and v2 (DashboardNewWorkspaceModal) Dialogs so alt-tabbing back restores focus to the modal. * Lint
Summary
Supersedes #3276 (credit @kkjcheng) — applies the same focus-trap fix to both v1 (
NewWorkspaceModal) and v2 (DashboardNewWorkspaceModal) Dialogs on thesync-ws-v1-v2branch.The monorepo's
Dialogwrapper (packages/ui/src/components/ui/dialog.tsx) overrides Radix's default and setsmodal = false, so dialogs must opt in to get Radix's focus trap. Withoutmodal, alt-tabbing away and back drops focus outside the dialog.Changes
modalprop toDialoginNewWorkspaceModal.tsx(v1)modalprop toDialoginDashboardNewWorkspaceModal.tsx(v2)onFocusOutside={(e) => e.preventDefault()}from earlier workTest plan