Skip to content

Commit

Permalink
make sure escape key closes algolia searchbar
Browse files Browse the repository at this point in the history
Signed-off-by: cosmicBboy <[email protected]>
  • Loading branch information
cosmicBboy committed Apr 14, 2024
1 parent 9afbf35 commit dc092aa
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/_static/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,10 @@ function main() {
}

document.addEventListener('DOMContentLoaded', main);
window.addEventListener('keydown', (event) => {
if (event.code === "Escape") {
// make sure to prevent default behavior with escape key so that algolia
// modal can be closed properly.
event.preventDefault();
}
});

0 comments on commit dc092aa

Please sign in to comment.