Skip to content

Commit

Permalink
Merge pull request #48850 from nextcloud/fix/unified-search-ctrl-f
Browse files Browse the repository at this point in the history
fix(unified-search): Close on second ctrl+f
  • Loading branch information
susnux authored Oct 23, 2024
2 parents b0197c5 + ed2295a commit d915a7c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
11 changes: 7 additions & 4 deletions core/src/views/UnifiedSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ export default defineComponent({

mounted() {
// register keyboard listener for search shortcut
window.addEventListener('keydown', this.onKeyDown)
if (window.OCP.Accessibility.disableKeyboardShortcuts() === false) {
window.addEventListener('keydown', this.onKeyDown)
}

// Allow external reset of the search / close local search
subscribe('nextcloud:unified-search:reset', () => {
Expand Down Expand Up @@ -131,9 +133,9 @@ export default defineComponent({
if (event.ctrlKey && event.code === 'KeyF') {
// only handle search if not already open - in this case the browser native search should be used
if (!this.showLocalSearch && !this.showUnifiedSearch) {
this.toggleUnifiedSearch()
event.preventDefault()
}
this.toggleUnifiedSearch()
}
},

Expand All @@ -142,9 +144,10 @@ export default defineComponent({
*/
toggleUnifiedSearch() {
if (this.supportsLocalSearch) {
this.showLocalSearch = true
this.showLocalSearch = !this.showLocalSearch
} else {
this.openModal()
this.showUnifiedSearch = !this.showUnifiedSearch
this.showLocalSearch = false
}
},

Expand Down
4 changes: 2 additions & 2 deletions dist/core-unified-search.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-unified-search.js.map

Large diffs are not rendered by default.

0 comments on commit d915a7c

Please sign in to comment.