overlays: Don't close overlays when drawing selections.

This fixes the following bug:
* Open the streams modal.
* Click and hold in the word "Streams" at the top.
* Move pointer up out of the modal.
* Release.
* Expected: Some text is selected, but nothing else happens.
* Actual: The modal disappears.

We use the same fix we use for this class of issue in other places:
checking for whether a range is selected, and if so, doing nothing.
This commit is contained in:
Tim Abbott 2021-06-18 17:00:58 -07:00
parent a307de95de
commit 081d74141b
1 changed files with 4 additions and 0 deletions

View File

@ -231,6 +231,10 @@ export function initialize() {
$("body").on("click", "div.overlay, div.overlay .exit", (e) => {
let $target = $(e.target);
if (document.getSelection().type === "Range") {
return;
}
// if the target is not the div.overlay element, search up the node tree
// until it is found.
if ($target.is(".exit, .exit-sign, .overlay-content, .exit span")) {