fix page up/down button not working (#1863)
This commit is contained in:
@@ -13,6 +13,7 @@ import { useKeyDown } from '../../hooks/useKeyDown';
|
|||||||
import { markAsRead } from '../../../client/action/notifications';
|
import { markAsRead } from '../../../client/action/notifications';
|
||||||
import { useMatrixClient } from '../../hooks/useMatrixClient';
|
import { useMatrixClient } from '../../hooks/useMatrixClient';
|
||||||
import { useRoomMembers } from '../../hooks/useRoomMembers';
|
import { useRoomMembers } from '../../hooks/useRoomMembers';
|
||||||
|
import { editableActiveElement } from '../../utils/dom';
|
||||||
|
|
||||||
export function Room() {
|
export function Room() {
|
||||||
const { eventId } = useParams();
|
const { eventId } = useParams();
|
||||||
@@ -28,7 +29,7 @@ export function Room() {
|
|||||||
window,
|
window,
|
||||||
useCallback(
|
useCallback(
|
||||||
(evt) => {
|
(evt) => {
|
||||||
if (isKeyHotkey('escape', evt)) {
|
if (isKeyHotkey('escape', evt) && !editableActiveElement()) {
|
||||||
markAsRead(mx, room.roomId);
|
markAsRead(mx, room.roomId);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ const shouldFocusMessageField = (evt: KeyboardEvent): boolean => {
|
|||||||
if (evt.metaKey || evt.altKey || evt.ctrlKey) {
|
if (evt.metaKey || evt.altKey || evt.ctrlKey) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// do not focus on F keys
|
// do not focus on F keys
|
||||||
if (/^F\d+$/.test(code)) return false;
|
if (/^F\d+$/.test(code)) return false;
|
||||||
|
|
||||||
@@ -36,6 +37,9 @@ const shouldFocusMessageField = (evt: KeyboardEvent): boolean => {
|
|||||||
code.startsWith('Alt') ||
|
code.startsWith('Alt') ||
|
||||||
code.startsWith('Control') ||
|
code.startsWith('Control') ||
|
||||||
code.startsWith('Arrow') ||
|
code.startsWith('Arrow') ||
|
||||||
|
code.startsWith('Page') ||
|
||||||
|
code.startsWith('End') ||
|
||||||
|
code.startsWith('Home') ||
|
||||||
code === 'Tab' ||
|
code === 'Tab' ||
|
||||||
code === 'Space' ||
|
code === 'Space' ||
|
||||||
code === 'Enter' ||
|
code === 'Enter' ||
|
||||||
|
|||||||
Reference in New Issue
Block a user