Fix :Ctrl+K triggers browser search#1659
Conversation
WalkthroughA new Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Browser
participant MailLayout
participant CommandPalette
User->>Browser: Presses Ctrl+K/Cmd+K
Browser->>MailLayout: Dispatches keydown event
MailLayout->>MailLayout: useEffect intercepts event, prevents default
MailLayout->>CommandPalette: Opens command palette (sets isCommandPaletteOpen = true)
Assessment against linked issues
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (2)📓 Common learningsapps/mail/components/mail/mail.tsx (1)🔇 Additional comments (1)
✨ 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.
PR Summary
Fixed browser shortcut conflict by preventing default Ctrl+K/Cmd+K behavior to properly trigger the app's command palette instead of browser search.
- Added event listener in
apps/mail/components/mail/mail.tsxto intercept and prevent default browser search behavior - Implemented proper cleanup with useEffect's return function to remove event listener
- Used
preventDefault()to stop browser's default find-in-page dialog from appearing - Ensured cross-browser compatibility by handling both
ctrlKeyandmetaKeyfor Windows/Linux and Mac respectively
1 file reviewed, no comments
Edit PR Review Bot Settings | Greptile
|
Which browser was this an issue in? we havent seen any issue with it? |
Windows, Brave .haven't tried it on mac |
Description
This PR resolves the issue where pressing Ctrl+K (or Cmd+K on Mac) was triggering the browser's default find-in-page dialog instead of opening the application's command palette. The fix ensures users can properly access the search and filter functionality within the mail interface.
Implementation
Type of Change
Please delete options that are not relevant.
Areas Affected
Please check all that apply:
Testing Done
Describe the tests you've done:
Security Considerations
For changes involving data or authentication:
Checklist
Additional Notes
fix.mp4
Closes #1658
Summary by CodeRabbit