Correctly detect keyboard input "Enter" (#479)

The "code" property returns the physical key that was pressed.
Thus, e.g. "Enter" on the numpad is "NumpadEnter" and not "Enter".
This commit is contained in:
schroda
2023-11-26 14:29:03 +01:00
committed by GitHub
parent c6cc7c14dd
commit ee9811bf53
4 changed files with 9 additions and 10 deletions

View File

@@ -132,7 +132,7 @@ export function VerticalPager(props: IReaderProps) {
useEffect(() => {
const handleKeyboard = (e: KeyboardEvent) => {
switch (e.code) {
switch (e.key) {
case 'Space':
e.preventDefault();
go(e.shiftKey ? 'up' : 'down');