Addepar / ember-widgets

https://opensource.addepar.com/ember-widgets/#/ember-widgets/overview
Other
288 stars 75 forks source link

WIP: Close popups in without checking target attachment #286

Closed mixonic closed 5 years ago

mixonic commented 5 years ago

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:

mixonic commented 5 years ago

I think this is also on the right track, but I've given up on trying to land it into the downstream app. Closing this for now.