From 93a645371142dfc3cce6b2eb969441f5df0bf1f7 Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Tue, 1 Apr 2025 21:36:38 -0700 Subject: [PATCH] Focus input on "/" key press --- script.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/script.js b/script.js index 53b6318..d8a88db 100644 --- a/script.js +++ b/script.js @@ -98,3 +98,7 @@ const input = document.querySelector('input'); input.addEventListener('input', e => handleChange(e.target.value)); input.value = new URL(document.location).searchParams.get('q') ?? '🏴‍☠️'; handleChange(input.value); // Render the default value on first load + +addEventListener('keyup', e => { + if (e.key === '/') { input.focus(); } +}); -- 2.47.3