Popups are handling click events after the logic for the page has rendered. This means sometimes you click on part of the page, Ember might re-render that part of the page and remove the click target, and then the closing logic in body-event-listener will run.
The closing logic confirmed that the click target is still on the page, but as mentioned above the click target may not be. It isn't clear why this logic exists in the first place.
Options to rationalize this: Remove the check for the target being on the page, or handle closing the popovers on capture phase before other logic related to the click happens, or use a psuedo-before-click event like mousedown.
Here the check is simply removed, meaning clicking on something outside the box will always cause a popover to be destroyed regardless of the target's attachment state.
Popups are handling click events after the logic for the page has rendered. This means sometimes you click on part of the page, Ember might re-render that part of the page and remove the click target, and then the closing logic in body-event-listener will run.
The closing logic confirmed that the click target is still on the page, but as mentioned above the click target may not be. It isn't clear why this logic exists in the first place.
Options to rationalize this: Remove the check for the target being on the page, or handle closing the popovers on capture phase before other logic related to the click happens, or use a psuedo-before-click event like mousedown.
Here the check is simply removed, meaning clicking on something outside the box will always cause a popover to be destroyed regardless of the target's attachment state.
References: