shortcut for focusing on cateogry chooser

practiced-songs
Matthew Huntington 7 months ago
parent bfc4e0c29f
commit 225c9d5e20

@ -1,5 +1,5 @@
<script setup> <script setup>
import { defineProps } from 'vue'; import { onMounted, defineProps, ref } from 'vue';
import { import {
currentWorkingCategory, currentWorkingCategory,
@ -12,9 +12,21 @@
currentWorkingCategory.value = categories.value.find(category => category.instrument === currentWorkingInstrument.value.name) currentWorkingCategory.value = categories.value.find(category => category.instrument === currentWorkingInstrument.value.name)
} }
const categoryInput = ref(null)
onMounted(()=>{
window.addEventListener('keydown', (event)=>{
if(event.ctrlKey === true){
if(event.key === 'c') {
categoryInput.value.focus();
}
}
})
})
</script> </script>
<template> <template>
<select @change="selectFirstInstrumentOfCategory" v-model="currentWorkingInstrument"> <select ref="categoryInput" @change="selectFirstInstrumentOfCategory" v-model="currentWorkingInstrument">
<option :value="instrument" v-for="instrument in instruments"> <option :value="instrument" v-for="instrument in instruments">
{{instrument.name}} {{instrument.name}}
</option> </option>

Loading…
Cancel
Save