Skip to content

Commit 135b57f

Browse files
fix: prevent the '/' being entered into the search input upon focus
Signed-off-by: Venkata Sai <[email protected]>
1 parent 747395c commit 135b57f

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)