jwstegemann / fritz2

Easily build reactive web-apps in Kotlin based on flows and coroutines.
https://www.fritz2.dev
MIT License
627 stars 25 forks source link

Fix nested Portals #833

Closed henryB99 closed 6 months ago

henryB99 commented 6 months ago

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.

henryB99 commented 6 months ago

The opening and closing event handling provided by OpenCloses protected methods is now handled by each component individually.