Skip to content

fix: #2294 Focus find-in-folder search box; unfocus with ESC - #3421

Closed
BBazard wants to merge 1 commit into
marktext:developfrom
BBazard:find_in_folder-focus
Closed

BBazard wants to merge 1 commit into
marktext:developfrom
BBazard:find_in_folder-focus

Conversation

@BBazard

@BBazard BBazard commented Aug 21, 2022

Copy link
Copy Markdown
Q A
Bug fix? yes
New feature? no
Breaking changes? no
Deprecations? no
New tests added? not needed
Fixed tickets Fixes #2294
License MIT

Description

This pull request changes the behavior of Edit: Find in Folder/(Ctrl+Shift+F) and View: Toggle Sidebar(Ctrl+J).

  • On Find in Folder: the search input is focused (whether the sidebar was previously open, closed or not yet created)
  • On Toggle Sidebar: when closing the sidebar the search input is unfocused (blurred) if it had the focus.
  • On Escape: the search input is unfocused (blurred) if it had the focus.

When the search input get focused, the search keyword is emptied. Which is the same behavior as 'Edit: Find'(Ctrl+F).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adjusts focus/blur behavior around the sidebar “Find in Folder” UI to address #2294, aiming to focus the sidebar search input when invoking Find-in-Folder and to unfocus it on sidebar close / Escape.

Changes:

  • Adds a template ref and focuses the find-in-folder input when handling the findInFolder action.
  • Alters sidebar open/close handling to trigger a new search-blur bus event.
  • Adds a search-blur listener to the editor find/replace bar that currently clears/hides the editor search UI.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/renderer/components/sideBar/search.vue Adds input ref + focusing logic; changes sidebar visibility watcher behavior.
src/renderer/components/search/index.vue Adds search-blur bus handling via blurSearch().

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

if (value && !oldValue) {
this.handleFindInFolder(false)
} else {
bus.$emit('search-blur')
@@ -7,6 +7,7 @@
type="text" v-model="keyword"
placeholder="Search in folder..."
@keyup="search"
Comment on lines +324 to +330
handleFindInFolder (focus = true) {
this.keyword = this.searchMatches.value
if (focus) {
this.$nextTick(() => {
this.$refs.search.focus()
})
}
},

blurSearch () {
this.emptySearch(true)
@Jocs

Jocs commented May 15, 2026

Copy link
Copy Markdown
Member

This project recently merged a large refactor (electron-vite migration, PR #4001) that upgraded dependencies and fixed several issues.

Please review this PR and let us know if it is still needed, or if the changes have already been addressed upstream.

Note: This PR currently has merge conflicts with the develop branch. If you decide to continue with this PR, please rebase or merge the latest develop branch to resolve the conflicts before it can be reviewed.

@BBazard

BBazard commented May 18, 2026

Copy link
Copy Markdown
Author

Most likely the changes are outdated, no need to keep the pull request.

Thank you for your work on marktext.

@BBazard BBazard closed this May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Focus find-in-folder search box; unfocus with ESC

3 participants