Skip to content

Commit d8e3af8

Browse files
authored
Merge pull request #431 from Venkata-Sai-Vishwanath-robo/fix
fix: Prevent the '/' being entered into the search input upon focus with '/' press
2 parents 747395c + 135b57f commit d8e3af8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

assets/js/offline-search.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@
172172

173173
//Bring focus to search bar
174174
$(document).on('keydown', function (event) {
175-
if (event.key === '/' ) {
175+
if (event.key === '/' && !(document.activeElement instanceof HTMLInputElement)) {
176+
event.preventDefault();
176177
$searchInput.focus();
177178
}
178179
});
@@ -193,6 +194,10 @@
193194
}
194195
});
195196

197+
$searchInput.on('blur', function () {
198+
$searchInput.val('');
199+
$searchInput.trigger('change');
200+
});
201+
196202
});
197203
})(jQuery);
198-

0 commit comments

Comments
 (0)