drop in onStartTyping to focus on search bar automatically

This commit is contained in:
geoffrey45
2022-06-16 09:50:07 +03:00
parent 79a7161827
commit 600b267ce4
2 changed files with 7 additions and 1 deletions
+5
View File
@@ -36,6 +36,7 @@ import useQStore from "@/stores/queue";
import useShortcuts from "@/composables/useKeyboard";
import Logo from "@/components/Logo.vue";
import { useRouter } from "vue-router";
import { onStartTyping } from "@vueuse/core";
const context_store = useContextStore();
const queue = useQStore();
@@ -53,6 +54,10 @@ app_dom.addEventListener("click", (e) => {
useRouter().afterEach(() => {
document.getElementById("acontent")?.scrollTo(0, 0);
});
onStartTyping(() => {
document.getElementById("globalsearch").focus();
});
</script>
<style lang="scss">
+2 -1
View File
@@ -3,7 +3,7 @@
<div id="ginner" tabindex="0">
<div class="icon image"></div>
<input
id="search"
id="globalsearch"
class="rounded"
v-model="search.query"
placeholder="Search your library"
@@ -16,6 +16,7 @@
</template>
<script setup lang="ts">
import { ref } from "vue";
import useSearchStore from "../../stores/search";
const search = useSearchStore();