Fix edit message not working (#552)
authorAjay Bura <ajbura@gmail.com>
Sat, 14 May 2022 14:35:43 +0000 (20:05 +0530)
committerAjay Bura <ajbura@gmail.com>
Sat, 14 May 2022 14:35:43 +0000 (20:05 +0530)
src/client/event/hotkeys.js

index ce52decf6d4014789675bfcfce43fb69a13da49c..c1b2af1df0b2693b769a96b51b7a0dc74511587f 100644 (file)
@@ -41,14 +41,17 @@ function listenKeyboard(event) {
     if (event.code === 'KeyV') {
       if (navigation.isRawModalVisible) return;
       const msgTextarea = document.getElementById('message-textarea');
-      if (document.activeElement !== msgTextarea && document.activeElement.tagName.toLowerCase() === 'input') return;
+      const { activeElement } = document;
+      if (activeElement !== msgTextarea
+        && ['input', 'textarea'].includes(activeElement.tagName.toLowerCase())
+      ) return;
       msgTextarea?.focus();
     }
   }
 
   if (!event.ctrlKey && !event.altKey && !event.metaKey) {
     if (navigation.isRawModalVisible) return;
-    if (document.activeElement.tagName.toLowerCase() === 'input') {
+    if (['input', 'textarea'].includes(document.activeElement.tagName.toLowerCase())) {
       return;
     }