Skip to content

Commit

Permalink
[#229][Crum/Search] Better Responsiveness.
Browse files Browse the repository at this point in the history
- Focus on the search box at the very beginning, before loading the
  index.
- Trigger the function with the page load event as well, so it will be
  there if a user, for example, visits another page and then goes back.
  • Loading branch information
pishoyg committed Sep 7, 2024
1 parent 937401d commit f7a262f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion site/data/build/xooxle.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';
const searchBox = document.getElementById('searchBox');
searchBox.focus();
const fullWordCheckbox = document.getElementById('fullWordCheckbox');
const regexCheckbox = document.getElementById('regexCheckbox');
const resultTable = document.getElementById('resultTable').querySelector('tbody');
Expand Down Expand Up @@ -187,4 +188,4 @@ searchBox.addEventListener('input', handleSearchQuery);
searchBox.addEventListener('keypress', handleSearchQuery);
fullWordCheckbox.addEventListener('click', handleSearchQuery);
fullWordCheckbox.addEventListener('click', handleSearchQuery);
searchBox.focus();
window.addEventListener('load', handleSearchQuery);
4 changes: 2 additions & 2 deletions site/xooxle.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const searchBox = document.getElementById('searchBox') as HTMLInputElement;
searchBox.focus();
const fullWordCheckbox = document.getElementById('fullWordCheckbox') as HTMLInputElement;
const regexCheckbox = document.getElementById('regexCheckbox') as HTMLInputElement;
const resultTable = document.getElementById('resultTable')!.querySelector('tbody')!;
Expand Down Expand Up @@ -224,5 +225,4 @@ searchBox.addEventListener('input', handleSearchQuery);
searchBox.addEventListener('keypress', handleSearchQuery);
fullWordCheckbox.addEventListener('click', handleSearchQuery);
fullWordCheckbox.addEventListener('click', handleSearchQuery);

searchBox.focus();
window.addEventListener('load', handleSearchQuery);

0 comments on commit f7a262f

Please sign in to comment.