File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -255,6 +255,30 @@ const [product, module] = Astro.url.pathname.split("/").filter(Boolean);
255255 }
256256 }
257257 });
258+
259+ document.addEventListener(
260+ "keydown",
261+ (keyboardEvent) => {
262+ const target = keyboardEvent.target;
263+
264+ const isInput =
265+ target instanceof EventTarget &&
266+ (("tagName" in target &&
267+ (target.tagName === "INPUT" ||
268+ target.tagName === "TEXTAREA" ||
269+ target.tagName === "SELECT")) ||
270+ ("isContentEditable" in target && target.isContentEditable));
271+
272+ if (keyboardEvent.key === "/" && !isInput) {
273+ keyboardEvent.preventDefault();
274+ keyboardEvent.stopPropagation();
275+ searchInput.focus();
276+ }
277+ },
278+ {
279+ capture: true,
280+ },
281+ );
258282 }
259283
260284 // Initialize when DOM is loaded
You can’t perform that action at this time.
0 commit comments