docsy
docsy copied to clipboard
Add a parameter to enable "live search"
Currently, local search with Lunr displays results when pressing enter, which in my opinion could feel weird, so for my project I wanted the search results to display each time the input text is modified. I struggled to find how to do this and the solution was to override the assets/js/offline-search.js file. Specifically the function from :
$searchInput.on('change', (event) => { render($(event.target));
// Hide keyboard on mobile browser
$searchInput.blur();
});
To :
$searchInput.on('input', (event) => { render($(event.target));
// Hide keyboard on mobile browser
$searchInput.blur();
});
I thought this could be added as a parameter since the default searchbar felt a bit odd to me. Hope I was clear :)