From 1bdd0449e02fb48425d9aa6071b0180415eb148b Mon Sep 17 00:00:00 2001 From: Ajay Bura Date: Sat, 14 May 2022 20:05:43 +0530 Subject: [PATCH] Fix edit message not working (#552) --- src/client/event/hotkeys.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/client/event/hotkeys.js b/src/client/event/hotkeys.js index ce52dec..c1b2af1 100644 --- a/src/client/event/hotkeys.js +++ b/src/client/event/hotkeys.js @@ -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; }