Skip to content

Commit de19c5e

Browse files
use existing listener
1 parent bdf2552 commit de19c5e

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/js/index.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2048,6 +2048,11 @@ window.addEventListener("keydown", event => {
20482048
if (event.code === "Escape") {
20492049
hideMenus();
20502050
hideModals();
2051+
} else if ((event.ctrlKey || event.metaKey) && event.key === 'f') {
2052+
event.preventDefault(); // Prevent the default browser behavior
2053+
searchContainer.classList.toggle('active');
2054+
// focus it
2055+
setTimeout(() => searchInput.focus(), 200); // cant focus it immediate with the transition, Delay focus to ensure visibility
20512056
}
20522057
});
20532058

@@ -2429,14 +2434,6 @@ function filterDials(searchTerm) {
24292434
animate();
24302435
}
24312436

2432-
document.addEventListener('keydown', (event) => {
2433-
if ((event.ctrlKey || event.metaKey) && event.key === 'f') {
2434-
event.preventDefault(); // Prevent the default browser behavior
2435-
searchContainer.classList.toggle('active');
2436-
// focus it
2437-
setTimeout(() => searchInput.focus(), 200); // cant focus it immediate with the transition, Delay focus to ensure visibility
2438-
}
2439-
});
24402437

24412438
document.getElementById('closeSearch').addEventListener('click', () => {
24422439
const searchInput = document.getElementById('searchInput');

0 commit comments

Comments
 (0)