From dc092aae359ff61062c789b7a971a8e66e370121 Mon Sep 17 00:00:00 2001 From: cosmicBboy Date: Sun, 14 Apr 2024 11:31:06 -0400 Subject: [PATCH] make sure escape key closes algolia searchbar Signed-off-by: cosmicBboy --- docs/_static/custom.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/_static/custom.js b/docs/_static/custom.js index 201653b4ad..7b974aa3bb 100644 --- a/docs/_static/custom.js +++ b/docs/_static/custom.js @@ -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(); + } +});