Skip to content

fix: handle Escape key in search panel inputs to close the panel#42

Merged
j4rviscmd merged 2 commits intomainfrom
fix/fix-esc-search-close
Mar 24, 2026
Merged

fix: handle Escape key in search panel inputs to close the panel#42
j4rviscmd merged 2 commits intomainfrom
fix/fix-esc-search-close

Conversation

@j4rviscmd
Copy link
Copy Markdown
Owner

Summary

  • Add Escape key handling directly in both the search and replace inputs of the SearchReplacePanel, since the existing global window listener in useSearchReplace was blocked by stopPropagation() on every keydown event
  • Extract stopAndClose and stopPropagate helper functions to reduce duplication across the two input handlers
  • Update JSDoc to reflect that Escape is now handled at both component and hook levels

Test plan

  • Press Ctrl+F to open the search panel
  • Type a query in the Find input, then press Escape — panel should close
  • Type text in the Replace input, then press Escape — panel should close
  • Press Ctrl+F, navigate matches with Enter/Shift+Enter — panel should stay open
  • Press Escape when search panel is closed — no side effects

🤖 Generated with Claude Code

j4rviscmd and others added 2 commits March 24, 2026 23:23
The search panel's onKeyDown handlers called stopPropagation on all
key events, preventing Escape from reaching the global window listener
in useSearchReplace. This fix adds Escape handling directly in both
the search and replace inputs, with stopImmediatePropagation to avoid
duplicate close() calls.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@j4rviscmd j4rviscmd added the bug Something isn't working label Mar 24, 2026
@j4rviscmd j4rviscmd merged commit a3f67a9 into main Mar 24, 2026
@j4rviscmd j4rviscmd deleted the fix/fix-esc-search-close branch March 24, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant