Repository navigation
Ctrl+P Navigates the Search Palette Instead of Closing It - #939
Merged
adibhanna merged 1 commit intoOct 14, 2026
Merged
Conversation
global.searchNotes is bound to Mod+P, which resolves to Ctrl+P on Linux and Windows. That is also the Emacs previous-item chord every palette handles through isPalettePreviousKey(). focusPaneHandler runs capture-phase on window, so its toggle called preventDefault() and stopImmediatePropagation() before React's delegated root listener ever saw the key. The Ctrl+P branch was unreachable while the palette was open. Ctrl+N, Ctrl+J and Ctrl+K were unaffected because none of them is a global binding, which is the whole of the asymmetry. Removes the toggle rather than guarding it. Escape, opening a note and clicking outside all still dismiss the palette, and the in-app manual already describes Mod+P as opening it rather than toggling. ZenNotes#510's capture-phase registration and the open path below are untouched, so Ctrl+P still opens the palette from the editor and still beats Vim's cursor-up.
Ctrl+P Navigates the Search Palette Instead of Closing It
adibhanna
added a commit
that referenced
this pull request
Oct 14, 2026
Review follow-up to #939, kept apart so @uNyanda's commit stands as theirs. The comment that explains why Search Notes is no longer a toggle cited #933, the New note form footer PR, for the Ctrl+P report. The report is #938. Behavior is unchanged. Checked in the built app on macOS: Cmd+P opens Search Notes, Ctrl+N and Ctrl+P move within it, Cmd+P inside it no longer closes it, and Escape does.
Contributor
|
Thanks @uNyanda, merged into the I checked it in the built app on macOS: A follow-up commit, 4ac1f63, only fixes the comment's reference: it cited #933 (the New note form footer PR) where the report is #938. |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ctrl+Pis documented in the Search Notes palette as an alternative toArrowUpfor moving the selection to the previous result. It closes the palette instead.The same chord closes it from inside the New note form, where the typed name, folder and tags live in component state, so the input is discarded.
global.searchNotesis bound toMod+P, which resolves toCtrl+Pon Linux and Windows andCmd+Pon macOS. That is the same chord as the Emacs previous-item key that every palette handles for list navigation. Open Notes (Space+O) moves the selection up on it today, which is the behaviour Search Notes is being brought into line with.Ctrl+N,Ctrl+JandCtrl+Kwere unaffected. None of them is a global binding, and that asymmetry is the whole of the report.Fixes #938.
The change
Removes the toggle from
focusPaneHandlerinApp.tsx. That is the entire fix: a net deletion of eight lines.The toggle is the sole cause. It sat in a capture-phase listener on
window, so it ran before React's delegated root listener, calledpreventDefault()andstopImmediatePropagation(), and made the palette's own key handler unreachable for as long as the palette was open.Removing the cause rather than guarding it matters. A guard would have to ask "is this chord wanted by the palette?", which can only answer correctly for the chords that exist today. With the toggle gone, any future global binding that overlaps a palette navigation chord is safe by default.
Nothing is lost by dropping it:
Escapecloses the palette, and the palette's own footer already says so.Mod+Pas opening the palette, not toggling it. Neither the keymap description nor the manual ever claimed otherwise, so this aligns the code with the documented contract rather than the reverse.What stays is the part #510 fixed: the capture-phase registration and the open path are untouched, so
Ctrl+Pstill opens the palette from the editor, and still wins over Vim'sCtrl+Pon Linux and Windows.A short comment at the site explains why it is deliberately not a toggle, and warns against reinstating it above the overlay guard.
Tests
None added, and that is a real gap worth naming.
The regression this guards against is the
App.tsxwiring, which no test covers: a reinstated capture-phase intercept would fail nothing.palette-nav.test.tsalready pins the chord set, which is what locates the defect precisely, but it cannot see this layer.Covering it would mean extracting the keydown dispatch out of the
useEffectinto a testable function. That is a larger refactor than this fix and is left as follow-up work.Verified manually in the running app:
Ctrl+Pmoves the selection up on the result list and in the New note form's folder and tag lists, the palette no longer toggles, and Open Notes still behaves as before.