Skip to content

Commit 5b15418

Browse files
authored
Hide search results on Escape key on desktop too for Aliki (#1593)
Extract commits from #1585
1 parent 96f9312 commit 5b15418

File tree

1 file changed

+8
-0
lines changed
  • lib/rdoc/generator/template/aliki/js

1 file changed

+8
-0
lines changed

lib/rdoc/generator/template/aliki/js/aliki.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ function hookSearch() {
9494
}
9595
});
9696

97+
// Hide search results on Escape key on desktop too
98+
document.addEventListener('keydown', (e) => {
99+
if (e.key === 'Escape' && input.matches(":focus")) {
100+
search.hide();
101+
input.blur();
102+
}
103+
});
104+
97105
// Show search results when focusing on input (if there's a query)
98106
input.addEventListener('focus', () => {
99107
if (input.value.trim()) {

0 commit comments

Comments
 (0)