Fix: Arrow-keys focus on background instead of modal - Live Website (Issue #1371)#1377
Conversation
WalkthroughThe Changes
Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/mail/hooks/use-mail-navigation.ts (1)
198-203: Fix formatting inconsistencies in hotkey configurations.The hotkey configurations have inconsistent spacing around the options objects, which affects code readability and consistency.
Apply this diff to fix the formatting:
- useHotkeys('j', handleArrowDown,{enabled: !isCommandPaletteOpen }); - useHotkeys('Enter', handleEnter, { preventDefault: true,enabled: !isCommandPaletteOpen }); - useHotkeys('Escape', handleEscape, { preventDefault: true,enabled: !isCommandPaletteOpen }); + useHotkeys('j', handleArrowDown, { enabled: !isCommandPaletteOpen }); + useHotkeys('Enter', handleEnter, { preventDefault: true, enabled: !isCommandPaletteOpen }); + useHotkeys('Escape', handleEscape, { preventDefault: true, enabled: !isCommandPaletteOpen });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/mail/hooks/use-mail-navigation.ts(5 hunks)
🔇 Additional comments (5)
apps/mail/hooks/use-mail-navigation.ts (5)
1-1: LGTM: Import statement is correct.The import for
useCommandPaletteis properly added to access the command palette's open state.
26-26: LGTM: Hook usage is correct.Properly destructuring the
openproperty asisCommandPaletteOpenfrom theuseCommandPalettehook for better readability.
244-244: LGTM: Early return prevents unintended navigation.The early return when the command palette is open effectively prevents repeated arrow key events from affecting mail navigation, which directly addresses the reported bug.
272-272: LGTM: Dependency array correctly updated.Adding
isCommandPaletteOpento the dependency array ensures the keydown event listener is properly updated when the command palette state changes.
274-278: LGTM: Keyboard state reset enhances user experience.Resetting
keyboardActiveRef.currentwhen the command palette opens ensures that keyboard navigation state is properly cleared, preventing any residual navigation state from interfering with the command palette interaction.
Description
Type of Change
Areas Affected
Please check all that apply:
Testing Done
Describe the tests you've done:
Security Considerations
For changes involving data or authentication:
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the project's license.
Summary by CodeRabbit