From de28d82b8133acc8cd1cf3c8d5372e2a3c47a7b3 Mon Sep 17 00:00:00 2001 From: Germain Date: Fri, 14 Jan 2022 12:49:09 +0000 Subject: [PATCH] Add onPaste fallback when getInputableElement returns null (#7540) --- src/components/structures/LoggedInView.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/structures/LoggedInView.tsx b/src/components/structures/LoggedInView.tsx index decfac67ba..b1ecfbf2e3 100644 --- a/src/components/structures/LoggedInView.tsx +++ b/src/components/structures/LoggedInView.tsx @@ -385,9 +385,9 @@ class LoggedInView extends React.Component { private onPaste = (ev: ClipboardEvent) => { const element = ev.target as HTMLElement; - const inputableElement = getInputableElement(element); + const inputableElement = getInputableElement(element) || document.activeElement as HTMLElement; - if (inputableElement) { + if (inputableElement?.focus) { inputableElement.focus(); } else { // refocusing during a paste event will make the