Skip to content

Commit

Permalink
🐛 fix(search): restore highlighting functionality
Browse files Browse the repository at this point in the history
Broke in #388.

- Rename local searchInput variable to inputValue
- Preserve global searchInput DOM element reference
  • Loading branch information
welpo committed Sep 24, 2024
1 parent fc04ab4 commit 3100730
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions static/js/searchElasticlunr.js
Original file line number Diff line number Diff line change
Expand Up @@ -2942,13 +2942,13 @@ window.onload = function () {
searchInput.addEventListener(
'input',
async function () {
const searchInput = this.value;
const searchTerm = searchInput.trim();
const inputValue = this.value;
const searchTerm = inputValue.trim();
const searchIndex = await searchIndexPromise;
results.innerHTML = '';

// Use the raw input so the "clear" button appears even if there's only spaces.
clearSearchButton.style.display = searchInput.length > 0 ? 'block' : 'none';
clearSearchButton.style.display = inputValue.length > 0 ? 'block' : 'none';
resultsContainer.style.display = searchTerm.length > 0 ? 'block' : 'none';

// Perform the search and store the results.
Expand Down
Loading

0 comments on commit 3100730

Please sign in to comment.