Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove disconnected autoPopovers during topMostPopoverAncestor algo
Prior to this change, a popover removed from the document would still be in the autoPopovers set, and subsequently `topMostPopverAncestor` would return disconnected elements, causing `closeAllPopovers` to hit an infinite loop: 1. `hidePopover` is called 2. `closeAllPopovers` is called 3. `topMostPopoverAncestor` is called and returns disconnected element. 4. `hidePopover(topMost)` is called but returns false, as the element is disconnected. 5. `topMostPopoverAncestor` is called, but it returns the same element. Repeat step 4, infinite loop. This commit alters `topMostAutoPopover` to check if the element is disconnected, and remove it from the set if so, only returning the first connected element. 1. `hidePopover` is called 2. `closeAllPopovers` is called 3. `topMostPopoverAncestor` is called, the first element is disconnected, so it skips and returns the first connected element. 4. `hidePopover(topMost)` is called and returns true. 5. No infinite loop.
- Loading branch information