Fix focusing on firefox
This commit is contained in:
parent
785b303166
commit
ed8929b55c
2 changed files with 23 additions and 50 deletions
|
@ -1,23 +0,0 @@
|
|||
<template>
|
||||
<div />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
mounted() {
|
||||
this.handler = event => {
|
||||
event.preventDefault();
|
||||
this.$emit('keyup', event);
|
||||
};
|
||||
window.addEventListener('keyup', this.handler);
|
||||
},
|
||||
beforeDestroy() {
|
||||
window.removeEventListener('keyup', this.handler);
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
div {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
|
@ -1,6 +1,4 @@
|
|||
<template>
|
||||
<div>
|
||||
<search-focus @keyup="focusSearch" />
|
||||
<div class="input-container">
|
||||
<div class="icon-container">
|
||||
<fluent-icon icon="search" class="icon" aria-hidden="true" />
|
||||
|
@ -16,16 +14,10 @@
|
|||
<span>{{ $t('SEARCH.PLACEHOLDER_KEYBINDING') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SearchFocus from './SearchFocus.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
SearchFocus,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
searchQuery: '',
|
||||
|
@ -33,6 +25,16 @@ export default {
|
|||
},
|
||||
mounted() {
|
||||
this.$refs.searchInput.focus();
|
||||
this.handler = e => {
|
||||
if (e.key === '/') {
|
||||
e.preventDefault();
|
||||
this.$refs.searchInput.focus();
|
||||
}
|
||||
};
|
||||
document.addEventListener('keydown', this.handler);
|
||||
},
|
||||
beforeDestroy() {
|
||||
window.removeEventListener('keydown', this.handler);
|
||||
},
|
||||
methods: {
|
||||
debounceSearch(e) {
|
||||
|
@ -44,12 +46,6 @@ export default {
|
|||
}
|
||||
}, 500);
|
||||
},
|
||||
focusSearch(e) {
|
||||
if (e.key === '/') {
|
||||
e.preventDefault();
|
||||
this.$refs.searchInput.focus();
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue