document.addEventListener('keydown', function (event) {
if (event.code == 'Slash') {
let input = document.getElementById('search');
- if (input !== document.activeElement) {
- setTimeout(function() {
- input.focus().select()
- }, 0);
+ if (input != null) {
+ if input !== document.activeElement) {
+ event.preventDefault();
+ setTimeout(function() {
+ input.focus().select()
+ }, 0);
+ }
}
}
});