fix page up/down button not working (#1863)
authorAjay Bura <32841439+ajbura@users.noreply.github.com>
Sun, 4 Aug 2024 05:36:42 +0000 (11:06 +0530)
committerGitHub <noreply@github.com>
Sun, 4 Aug 2024 05:36:42 +0000 (15:36 +1000)
src/app/features/room/Room.tsx
src/app/features/room/RoomView.tsx

index ee3e702740596649364aee2c0ce0669823c0d81d..a4ec716512c082403fed3ff07381e08d51977ec2 100644 (file)
@@ -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();
@@ -28,7 +29,7 @@ export function Room() {
     window,
     useCallback(
       (evt) => {
-        if (isKeyHotkey('escape', evt)) {
+        if (isKeyHotkey('escape', evt) && !editableActiveElement()) {
           markAsRead(mx, room.roomId);
         }
       },
index 3eabd528ad938a4ef24ef2b4846ebf24fce0379b..250afc930b2cdc049063515071a7218e1f38f1cf 100644 (file)
@@ -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;
 
@@ -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' ||