Skip to content

Commit 2666cc8

Browse files
committed
fix(core): skip unified-search Ctrl+F on pages with their own handler
-e Signed-off-by: Peter Ringelmann <peter.ringelmann@nextcloud.com>
1 parent fcfd369 commit 2666cc8

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

core/src/views/UnifiedSearch.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,17 @@ export default defineComponent({
8383
*/
8484
supportsLocalSearch() {
8585
// TODO: Make this an API
86-
const providerPaths = ['/settings/users', '/apps/deck', '/settings/apps']
86+
const providerPaths = ['/apps/deck', '/settings/apps']
87+
return providerPaths.some((path) => this.currentLocation.pathname?.includes?.(path))
88+
},
89+
90+
/**
91+
* Current page handles the Ctrl+F shortcut itself (e.g. has a dedicated
92+
* search input). UnifiedSearch should stay out of the way on these pages.
93+
*/
94+
appHandlesSearchShortcut() {
95+
// TODO: Make this an API
96+
const providerPaths = ['/settings/users']
8797
return providerPaths.some((path) => this.currentLocation.pathname?.includes?.(path))
8898
},
8999
},
@@ -135,6 +145,10 @@ export default defineComponent({
135145
*/
136146
onKeyDown(event: KeyboardEvent) {
137147
if (event.ctrlKey && event.key === 'f') {
148+
// Skip on pages that handle Ctrl+F themselves (e.g. a dedicated search input).
149+
if (this.appHandlesSearchShortcut) {
150+
return
151+
}
138152
// only handle search if not already open - in this case the browser native search should be used
139153
if (!this.showLocalSearch && !this.showUnifiedSearch) {
140154
event.preventDefault()

0 commit comments

Comments
 (0)