Use key instead of code in type-in field (#3166)

* Use key instead of code in type-in field

* Use event.key for Enter
This commit is contained in:
Abdo 2024-05-01 09:59:11 +03:00 committed by GitHub
parent 22ecab1a0e
commit 573af9cd4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -116,7 +116,7 @@ function useInputHandler(): [InputHandlerAPI, SetupInputHandlerAction] {
specialKey.dispatch({ event, action: "caretRight" });
} else if (isArrowLeft(event)) {
specialKey.dispatch({ event, action: "caretLeft" });
} else if (event.code === "Enter" || event.code === "NumpadEnter") {
} else if (event.key === "Enter") {
specialKey.dispatch({ event, action: "enter" });
} else if (event.code === "Tab") {
specialKey.dispatch({ event, action: "tab" });

View File

@ -222,8 +222,8 @@ export function _drawMark(mark: boolean): void {
}
export function _typeAnsPress(): void {
const code = (window.event as KeyboardEvent).code;
if (["Enter", "NumpadEnter"].includes(code)) {
const key = (window.event as KeyboardEvent).key;
if (key === "Enter") {
bridgeCommand("ans");
}
}