diff --git a/lib/rdoc/generator/template/aliki/js/aliki.js b/lib/rdoc/generator/template/aliki/js/aliki.js index c9a8b54a0e..7883132b00 100644 --- a/lib/rdoc/generator/template/aliki/js/aliki.js +++ b/lib/rdoc/generator/template/aliki/js/aliki.js @@ -94,6 +94,14 @@ function hookSearch() { } }); + // Hide search results on Escape key on desktop too + document.addEventListener('keydown', (e) => { + if (e.key === 'Escape' && input.matches(":focus")) { + search.hide(); + input.blur(); + } + }); + // Show search results when focusing on input (if there's a query) input.addEventListener('focus', () => { if (input.value.trim()) {