From 82d7617287ab1a1dfdea766a9689ea773a85fe99 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 23 Jul 2019 09:44:17 +0200 Subject: [PATCH] add comments --- src/components/structures/LoggedInView.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/structures/LoggedInView.js b/src/components/structures/LoggedInView.js index cfa39af92a..3730b979f7 100644 --- a/src/components/structures/LoggedInView.js +++ b/src/components/structures/LoggedInView.js @@ -288,6 +288,9 @@ const LoggedInView = React.createClass({ element = element.parentElement; } if (!canReceiveInput) { + // refocusing during a paste event will make the + // paste end up in the newly focused element, + // so dispatch synchronously before paste happens dis.dispatch({action: 'focus_composer'}, true); } }, @@ -395,6 +398,7 @@ const LoggedInView = React.createClass({ (ev.key === "Space" || ev.key === "Enter"); if (!isClickShortcut && !canElementReceiveInput(ev.target)) { + // synchronous dispatch so we focus before key generates input dis.dispatch({action: 'focus_composer'}, true); ev.stopPropagation(); // we should *not* preventDefault() here as