This fixes the closing behavior of the headless PopUpPanel described in #832 by keeping track of created PopUpPanel instances and associating them with the closest containing PopUpPanel. This information is used to get all child instances contained by a given PopUpPanel to determine if the event originated from any of these. If it is, the pop-up is not closed, even though the elements aren't children of the PopUpPanels in the DOM.
This fix is heavily inspired by Floating UIs useDismiss and FloatingTree utilities for React, which also deal with handling events coming from nested portals.
This fixes the closing behavior of the headless
PopUpPanel
described in #832 by keeping track of createdPopUpPanel
instances and associating them with the closest containingPopUpPanel
. This information is used to get all child instances contained by a givenPopUpPanel
to determine if the event originated from any of these. If it is, the pop-up is not closed, even though the elements aren't children of thePopUpPanel
s in the DOM.This fix is heavily inspired by Floating UIs useDismiss and FloatingTree utilities for React, which also deal with handling events coming from nested portals.