diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-10-23 12:49:33 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-10-23 13:24:07 +0200 |
commit | d7376891a24709bb48e04570c3642b9b170e56de (patch) | |
tree | 3187dad761d5bb6fa42137dacb4c7f2141b3db89 | |
parent | 74cd6e295a8e2e7c64e4fe38ba775986c57509a4 (diff) | |
download | nextcloud-server-d7376891a24709bb48e04570c3642b9b170e56de.tar.gz nextcloud-server-d7376891a24709bb48e04570c3642b9b170e56de.zip |
fix(unified-search): Close on second ctrl+f
Also only add the event listener if short-cuts are not disabled for accessibility reasons.
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
-rw-r--r-- | core/src/views/UnifiedSearch.vue | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/core/src/views/UnifiedSearch.vue b/core/src/views/UnifiedSearch.vue index fc1d456247c..38b18814665 100644 --- a/core/src/views/UnifiedSearch.vue +++ b/core/src/views/UnifiedSearch.vue @@ -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', () => { @@ -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() } }, @@ -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 } }, |