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 === "") {