Skip to content

Commit a7cd096

Browse files
committed
Add Esc key to clear search when search box is focused
1 parent 6adcfc5 commit a7cd096

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

public/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ <h1 class="text-2xl font-bold truncate">takeCode</h1>
7575
if (e.ctrlKey && e.key === 'k') {
7676
e.preventDefault();
7777
document.getElementById('search').focus();
78+
} else if (e.key === 'Escape' && document.activeElement === document.getElementById('search')) {
79+
clearSearch();
7880
}
7981
});
8082
</script>

0 commit comments

Comments
 (0)