From 0b3c45ce4b05c8b16a25864d905e9103b0f02412 Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Wed, 3 Apr 2024 12:12:54 +0000 Subject: [PATCH] Detect slash key by value, not physical position (#415) The solution is trivial; read the [property](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#instance_properties) for actual meaning instead of physical position. Reviewed-on: https://codeberg.org/Codeberg/Documentation/pulls/415 Reviewed-by: Gusted Co-authored-by: Andrew Kvalheim Co-committed-by: Andrew Kvalheim --- content/_includes/default_layout.njk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/_includes/default_layout.njk b/content/_includes/default_layout.njk index 419cc5c..5814e96 100644 --- a/content/_includes/default_layout.njk +++ b/content/_includes/default_layout.njk @@ -44,7 +44,7 @@ containerElement: "#search-results" })); document.addEventListener('keydown', (event) => { - if (event.code == "Slash") { + if (event.key == "/") { event.preventDefault(); document.getElementById("search-input").focus(); }