Skip to content

Commit

Permalink
fix page up/down button not working (#1863)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajbura authored Aug 4, 2024
1 parent 681287c commit 96222de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app/features/room/Room.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { useKeyDown } from '../../hooks/useKeyDown';
import { markAsRead } from '../../../client/action/notifications';
import { useMatrixClient } from '../../hooks/useMatrixClient';
import { useRoomMembers } from '../../hooks/useRoomMembers';
import { editableActiveElement } from '../../utils/dom';

export function Room() {
const { eventId } = useParams();
Expand All @@ -28,7 +29,7 @@ export function Room() {
window,
useCallback(
(evt) => {
if (isKeyHotkey('escape', evt)) {
if (isKeyHotkey('escape', evt) && !editableActiveElement()) {
markAsRead(mx, room.roomId);
}
},
Expand Down
4 changes: 4 additions & 0 deletions src/app/features/room/RoomView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const shouldFocusMessageField = (evt: KeyboardEvent): boolean => {
if (evt.metaKey || evt.altKey || evt.ctrlKey) {
return false;
}

// do not focus on F keys
if (/^F\d+$/.test(code)) return false;

Expand All @@ -36,6 +37,9 @@ const shouldFocusMessageField = (evt: KeyboardEvent): boolean => {
code.startsWith('Alt') ||
code.startsWith('Control') ||
code.startsWith('Arrow') ||
code.startsWith('Page') ||
code.startsWith('End') ||
code.startsWith('Home') ||
code === 'Tab' ||
code === 'Space' ||
code === 'Enter' ||
Expand Down

0 comments on commit 96222de

Please sign in to comment.