Updated keyboard events to take advantage of the KeyboardEvent object

This commit is contained in:
Chris Kankiewicz
2020-12-28 11:24:12 -07:00
parent 6cad0a0fca
commit 587e758069
2 changed files with 2 additions and 2 deletions

View File

@@ -19,7 +19,7 @@ const app = new Vue({
}
},
mounted: function() {
window.addEventListener('keyup', e => e.keyCode == 191 && this.$refs.searchInput.focus());
window.addEventListener('keyup', e => e.key == '/' && this.$refs.searchInput.focus());
let scrollToTop = this.$refs.scrollToTop;
window.addEventListener('scroll', function() {

View File

@@ -86,7 +86,7 @@
}
},
mounted() {
window.addEventListener('keyup', e => e.keyCode == 27 && this.hide());
window.addEventListener('keyup', e => e.key == 'Escape' && this.hide());
}
}
</script>