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:
parent
91bc7ec69f
commit
0b3c45ce4b
1 changed files with 1 additions and 1 deletions
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue