2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 19:20:55 +00:00

Fixes for input autofocus, etc

This commit is contained in:
Oliver Walters
2022-03-29 23:49:06 +11:00
parent f724f4a845
commit 016d802a10
3 changed files with 19 additions and 9 deletions

View File

@ -27,16 +27,23 @@ function openSearchPanel() {
clearSearchResults();
// Finally, grab keyboard focus in the search bar
panel.find('#search-input').focus();
panel.find('#search-input').on('keyup change', searchTextChanged);
// Callback for "clear search" button
panel.find('#search-clear').click(function() {
panel.find('#search-clear').click(function(event) {
// Prevent this button from actually submitting the form
event.preventDefault();
panel.find('#search-input').val('');
clearSearchResults();
});
// Callback for the "close search" button
panel.find('#search-close').click(function(event) {
// Prevent this button from actually submitting the form
event.preventDefault();
});
}
var searchRequests = [];
@ -211,6 +218,9 @@ function clearSearchResults() {
// Delete any existing search results
panel.find('#search-results').empty();
// Finally, grab keyboard focus in the search bar
panel.find('#search-input').focus();
}