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.
This commit is contained in:
evykassirer 2023-04-13 16:04:07 -07:00 committed by Tim Abbott
parent 32f75085cb
commit 429f23fc4f
1 changed files with 1 additions and 8 deletions

View File

@ -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