Problem
The CodeMirror search dialog opened by Ctrl+F / Cmd+F is non-persistent. Pressing Enter closes the dialog and returns focus to the snippet editor, including when there are no matches. Users may then accidentally type, paste, or press Enter in their code.
Forum report: https://wordpress.org/support/topic/issues-caused-by-the-built-in-search-behavior/
Current behaviour
Code Snippets already loads CodeMirror's persistent findPersistent command on Alt+F. Ctrl+F / Cmd+F still use CodeMirror's default non-persistent find command.
Acceptance criteria
- Map Ctrl+F and Cmd+F to CodeMirror's existing
findPersistent command.
- Keep focus in the search input after Enter.
- Escape or an explicit close action returns focus to the code editor.
- Make the search field sufficiently wide for typical code queries.
- Show an accessible, visible no-results state.
- Verify Default, Vim, Emacs, and Sublime Text keymaps do not regress.
- Verify Tab inserts or indents immediately under the Default keymap.
Scope
Reuse CodeMirror's search API. Do not build a separate search engine unless its API cannot meet these requirements.
Problem
The CodeMirror search dialog opened by Ctrl+F / Cmd+F is non-persistent. Pressing Enter closes the dialog and returns focus to the snippet editor, including when there are no matches. Users may then accidentally type, paste, or press Enter in their code.
Forum report: https://wordpress.org/support/topic/issues-caused-by-the-built-in-search-behavior/
Current behaviour
Code Snippets already loads CodeMirror's persistent
findPersistentcommand on Alt+F. Ctrl+F / Cmd+F still use CodeMirror's default non-persistentfindcommand.Acceptance criteria
findPersistentcommand.Scope
Reuse CodeMirror's search API. Do not build a separate search engine unless its API cannot meet these requirements.