From 429f23fc4fdd7ce897249678cb1dbe18173bd3ba Mon Sep 17 00:00:00 2001 From: evykassirer Date: Thu, 13 Apr 2023 16:04:07 -0700 Subject: [PATCH] click handler: Consolidate composebox-closing logic. Previously, we stopped the composebox from closing on in-composebox clicks by stopping propagation from the composebox click handler. This was an issue because we need to propagate the event to bootstrap in situations like dropdown clicks. We can avoid closing the composebox on in-composebox clicks by just checking if the click is in the composebox. --- web/src/click_handlers.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/web/src/click_handlers.js b/web/src/click_handlers.js index 7ae5f291af..e79c5f82b6 100644 --- a/web/src/click_handlers.js +++ b/web/src/click_handlers.js @@ -679,14 +679,6 @@ export function initialize() { return; } - // Don't let clicks in the compose area count as - // "unfocusing" our compose -- in other words, e.g. - // clicking "Press Enter to send" should not - // trigger the composebox-closing code in MAIN CLICK HANDLER. - // But do allow our formatting link. - if (!$target.is("a")) { - e.stopPropagation(); - } // Still hide the popovers, however popovers.hide_all(); } @@ -876,6 +868,7 @@ export function initialize() { $("#compose-textarea").trigger("focus"); return; } else if ( + !$(e.target).parents("#compose").length && !window.getSelection().toString() && // Clicking any input or text area should not close // the compose box; this means using the sidebar