Skip to content

fix: allow Find in Files hotkey to work after closing a script tab#1745

Merged
willeastcott merged 3 commits intomainfrom
fix/find-in-files-hotkey-after-close
Feb 12, 2026
Merged

fix: allow Find in Files hotkey to work after closing a script tab#1745
willeastcott merged 3 commits intomainfrom
fix/find-in-files-hotkey-after-close

Conversation

@willeastcott
Copy link
Contributor

@willeastcott willeastcott commented Feb 12, 2026

Summary

  • When a script tab is closed, the code panel is hidden with visibility: hidden but Monaco's internal <textarea> retains DOM focus
  • The global hotkey system in hotkey.ts ignores keydown events targeting <textarea> elements without the hotkeys class, so Ctrl+Shift+F is silently dropped
  • Blur the active element inside the code panel when toggleCode(false) is called, so the global hotkey handler can receive keyboard events
  • Add a null model guard in picker:search:open to prevent errors when no document is open

Fixes #1730

Test Plan

  • Open Code Editor with no code tabs open
  • Press Ctrl+Shift+F -- verify Find in Files tab opens
  • Close Find in Files tab
  • Open a script file
  • Close the script tab
  • Press Ctrl+Shift+F -- verify Find in Files tab opens again
  • Open a script, select some text, press Ctrl+Shift+F -- verify selection is used as search value

When a script tab is closed, the code panel is hidden with visibility: hidden but Monaco's internal textarea retains DOM focus. This causes the global hotkey system to ignore Ctrl+Shift+F since it skips events targeting textarea elements.

Blur the active element when hiding the code panel so the global hotkey handler can receive keyboard events. Also guard against a null model in picker:search:open to prevent errors when no document is open.

Fixes #1730

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the “Find in Files” global hotkey (Ctrl+Shift+F) becoming unresponsive after closing the last script tab by ensuring Monaco’s hidden textarea doesn’t retain focus, and hardens search picker behavior when no document/model is open.

Changes:

  • Blur the currently focused element inside the code panel when the code panel is hidden (toggleCode(false)), so global hotkeys are not ignored due to textarea targeting.
  • Add a guard around monacoEditor.getModel() before deriving a search value from the current selection.
  • (As part of the above) avoid errors when opening search with no active document.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/code-editor/pickers/picker-search.ts Adds model guard before using selection text as the default search value.
src/code-editor/monaco/monaco.ts Blurs focused element when hiding the code panel to restore global hotkey handling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@willeastcott willeastcott merged commit c410d05 into main Feb 12, 2026
3 checks passed
@willeastcott willeastcott deleted the fix/find-in-files-hotkey-after-close branch February 12, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: code editor bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Code Editor] Allow search without opening a source file

2 participants