fix: allow command palette search results to open in new tab
Summary
- allow Command+Click / Ctrl+Click on command palette search entries to open in a new tab
- prevent default command selection when opening a new tab while keeping the palette behaviour unchanged for normal clicks
Testing
- Not run (not requested)
https://chatgpt.com/codex/tasks/task_e_68fa0caa8aec832a9b2eb5bb478c09eb
Summary by CodeRabbit
- New Features
- Users can now open search results in a new tab by using Cmd/Ctrl+click in the command palette search results.
[!NOTE]
Other AI code review bot(s) detected
CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.
Walkthrough
Refactored click handling in the search results component to support meta/ctrl-click for opening items in new tabs. The targetPath is now computed once upfront and reused across regular navigation and meta-click flows, with added handleMetaClick to detect modifier keys and open paths in new windows.
Changes
| Cohort / File(s) | Summary |
|---|---|
Meta-click support for search results apps/web/core/components/command-palette/actions/search-results.tsx |
Introduced targetPath variable for consistent path handling across regular onSelect and meta-click flows; added handleMetaClick function to detect Cmd/Ctrl key and open targetPath in new tab; added MouseEvent type import |
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~12 minutes
Poem
🐰 A palette of searches, now with a twist,
Meta-click opens tabs we won't miss,
One path computed, reused with care,
New windows spawn through the air! ✨
Pre-merge checks and finishing touches
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title Check | ✅ Passed | The pull request title "fix: allow command palette search results to open in new tab" is clear, specific, and directly summarizes the main change in the changeset. It accurately reflects the core functionality added—enabling meta/ctrl-click support to open search results in a new tab. The title is concise, avoids generic language, and would be meaningful to a developer scanning the project history. |
| Description Check | ✅ Passed | The pull request description conveys the essential information about the changes—what was modified (meta/ctrl-click support for command palette) and why (to enable opening in new tab while preventing default behavior for normal clicks). It includes test information, a reference link, and testing status. However, the description deviates from the template structure by using "Summary" instead of "Description" as the heading and omits the "Type of Change" checkbox section that is explicitly required in the template. Despite these structural gaps, the description is not largely incomplete and provides sufficient information about the changeset. |
| Docstring Coverage | ✅ Passed | No functions found in the changes. Docstring coverage check skipped. |
✨ Finishing touches
- [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
- [ ] Commit unit tests in branch
codex/fix-command/ctrl-click-navigation-issue
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 @coderabbitai help to get the list of available commands and usage tips.