From 31f7cfa09fd4878f1fcf44d278590e6cdc0eb76d Mon Sep 17 00:00:00 2001 From: Bastien Wirtz Date: Thu, 27 Feb 2025 13:50:36 +0100 Subject: [PATCH] fix(search): Allow usage of the hotkey in the text --- src/components/SearchInput.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/SearchInput.vue b/src/components/SearchInput.vue index 8a31884..22e540e 100644 --- a/src/components/SearchInput.vue +++ b/src/components/SearchInput.vue @@ -29,7 +29,7 @@ export default { emits: ["search-open", "search-focus", "search-cancel", "input"], mounted() { this._keyListener = function (event) { - if (event.key === this.hotkey) { + if (!this.hasFocus() && event.key === this.hotkey) { event.preventDefault(); this.focus(); } @@ -63,6 +63,9 @@ export default { this.$refs.search.focus(); }); }, + hasFocus: function () { + return document.activeElement == this.$refs.search + }, setSearchURL: function (value) { const url = new URL(window.location); if (value === "") {