Support mark as read by ESC while in room input (#669)
authorDean Bassett <dean@dbassett.dev>
Mon, 18 Jul 2022 16:36:51 +0000 (09:36 -0700)
committerGitHub <noreply@github.com>
Mon, 18 Jul 2022 16:36:51 +0000 (22:06 +0530)
fixes #cinnyapp/cinny/668

src/client/event/hotkeys.js

index c1b2af1df0b2693b769a96b51b7a0dc74511587f..221706535486d8cac14e4c0360125f83ba137d82 100644 (file)
@@ -51,9 +51,6 @@ function listenKeyboard(event) {
 
   if (!event.ctrlKey && !event.altKey && !event.metaKey) {
     if (navigation.isRawModalVisible) return;
-    if (['input', 'textarea'].includes(document.activeElement.tagName.toLowerCase())) {
-      return;
-    }
 
     if (event.code === 'Escape') {
       if (navigation.isRoomSettings) {
@@ -66,6 +63,10 @@ function listenKeyboard(event) {
       }
     }
 
+    if (['input', 'textarea'].includes(document.activeElement.tagName.toLowerCase())) {
+      return;
+    }
+
     // focus the text field on most keypresses
     if (shouldFocusMessageField(event.code)) {
       // press any key to focus and type in message field