fix(overlays): fix an edge case in hiding outside elements (#9365)
* fix(overlays): fix an edge case in hiding outside elements
When working with WYSIWYG editors or similar components that mutate the dom, the order or dome mutations could be in a way that dom mutation observer is called for elements that are not yet appended to the modal dom at the time MutationObserver callback is called.
This change adds a safe-guard for such cases, by checking if the target element is connected, as otherwise it will be considered outside the currently visible elements.
* comment clarification
---------
Co-authored-by: Alireza Mirian <saym@danskebank.com>
Co-authored-by: Robert Snow <snowystinger@gmail.com>