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 <gusted@noreply.codeberg.org>
Co-authored-by: Andrew Kvalheim <andrew@kvalhe.im>
Co-committed-by: Andrew Kvalheim <andrew@kvalhe.im>
This commit is contained in:
Andrew Kvalheim 2024-04-03 12:12:54 +00:00 committed by Gusted
parent 91bc7ec69f
commit 0b3c45ce4b

View file

@ -44,7 +44,7 @@
containerElement: "#search-results" containerElement: "#search-results"
})); }));
document.addEventListener('keydown', (event) => { document.addEventListener('keydown', (event) => {
if (event.code == "Slash") { if (event.key == "/") {
event.preventDefault(); event.preventDefault();
document.getElementById("search-input").focus(); document.getElementById("search-input").focus();
} }