Skip to content

Commit d915a7c

Browse files
authored
Merge pull request #48850 from nextcloud/fix/unified-search-ctrl-f
fix(unified-search): Close on second ctrl+f
2 parents b0197c5 + ed2295a commit d915a7c

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

core/src/views/UnifiedSearch.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ export default defineComponent({
9797
9898
mounted() {
9999
// register keyboard listener for search shortcut
100-
window.addEventListener('keydown', this.onKeyDown)
100+
if (window.OCP.Accessibility.disableKeyboardShortcuts() === false) {
101+
window.addEventListener('keydown', this.onKeyDown)
102+
}
101103
102104
// Allow external reset of the search / close local search
103105
subscribe('nextcloud:unified-search:reset', () => {
@@ -131,9 +133,9 @@ export default defineComponent({
131133
if (event.ctrlKey && event.code === 'KeyF') {
132134
// only handle search if not already open - in this case the browser native search should be used
133135
if (!this.showLocalSearch && !this.showUnifiedSearch) {
134-
this.toggleUnifiedSearch()
135136
event.preventDefault()
136137
}
138+
this.toggleUnifiedSearch()
137139
}
138140
},
139141
@@ -142,9 +144,10 @@ export default defineComponent({
142144
*/
143145
toggleUnifiedSearch() {
144146
if (this.supportsLocalSearch) {
145-
this.showLocalSearch = true
147+
this.showLocalSearch = !this.showLocalSearch
146148
} else {
147-
this.openModal()
149+
this.showUnifiedSearch = !this.showUnifiedSearch
150+
this.showLocalSearch = false
148151
}
149152
},
150153

dist/core-unified-search.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core-unified-search.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)