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:
@@ -127,7 +127,7 @@ export function DoublePagedPager(props: IReaderProps) {
|
||||
}
|
||||
|
||||
function keyboardControl(e: KeyboardEvent) {
|
||||
switch (e.code) {
|
||||
switch (e.key) {
|
||||
case 'Space':
|
||||
e.preventDefault();
|
||||
nextPage();
|
||||
|
||||
@@ -54,7 +54,7 @@ export function PagedPager(props: IReaderProps) {
|
||||
}
|
||||
|
||||
function keyboardControl(e: KeyboardEvent) {
|
||||
switch (e.code) {
|
||||
switch (e.key) {
|
||||
case 'Space':
|
||||
e.preventDefault();
|
||||
nextPage();
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user