1
0
Fork 0
mirror of https://github.com/bastienwirtz/homer.git synced 2026-01-23 02:15:09 +00:00

fix(search): Allow usage of the hotkey in the text

This commit is contained in:
Bastien Wirtz 2025-02-27 13:50:36 +01:00
parent 36d753df58
commit 31f7cfa09f

View file

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