Keep Bestellungen search focus
This commit is contained in:
@@ -629,8 +629,20 @@ function render_auth_home_page(array $user, array $otcProducts = [], array $best
|
||||
echo " table = getTable();";
|
||||
echo " return !!table;";
|
||||
echo " };";
|
||||
echo " const focusSearchInput = () => {";
|
||||
echo " const input = getSearchInput();";
|
||||
echo " if (!input) { return; }";
|
||||
echo " input.focus({ preventScroll: true });";
|
||||
echo " const end = input.value.length;";
|
||||
echo " try {";
|
||||
echo " input.setSelectionRange(end, end);";
|
||||
echo " } catch (error) {";
|
||||
echo " void error;";
|
||||
echo " }";
|
||||
echo " };";
|
||||
echo " const loadFragment = async (params) => {";
|
||||
echo " if (searchTimer) { window.clearTimeout(searchTimer); searchTimer = null; }";
|
||||
echo " const wasSearchFocused = getSearchInput() ? document.activeElement === getSearchInput() : false;";
|
||||
echo " const url = buildFragmentUrl(params);";
|
||||
echo " const response = await fetch(url.toString(), { credentials: 'same-origin', headers: { 'X-Requested-With': 'XMLHttpRequest' } });";
|
||||
echo " const html = await response.text();";
|
||||
@@ -639,6 +651,7 @@ function render_auth_home_page(array $user, array $otcProducts = [], array $best
|
||||
echo " const historyUrl = buildUrl(params);";
|
||||
echo " window.history.replaceState({}, '', historyUrl);";
|
||||
echo " bindTable();";
|
||||
echo " if (wasSearchFocused) { focusSearchInput(); }";
|
||||
echo " }";
|
||||
echo " };";
|
||||
echo " const bindTable = () => {";
|
||||
@@ -658,7 +671,7 @@ function render_auth_home_page(array $user, array $otcProducts = [], array $best
|
||||
echo " bestellungen_dir: getSortDirection(),";
|
||||
echo " bestellungen_limit: getPageSize(),";
|
||||
echo " });";
|
||||
echo " }, 250);";
|
||||
echo " }, 500);";
|
||||
echo " });";
|
||||
echo " }";
|
||||
echo " if (clearButton && clearButton.dataset.bestellungenBound !== 'true') {";
|
||||
|
||||
Reference in New Issue
Block a user