Menu, ContextMenu, TieredMenu, OverlayPanel: Click outside of menu does not close component, when rendered in a different browsing context (e.g. window.open) #7441
Labels
Status: Needs Triage
Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Describe the bug
When a menu is rendered in a newly created window (using window.open()), the menu does not close when clicking outside of the menu (which is the normal behavior when rendered in the main window).
This seems to be due to the usage of
useEventListener
anduseOverlayListener
without specifyingtarget
, which then defaults todocument
/'window'. However in this case, it should be theownerDocument
of the menu or the respective window.Reproducer
StackBlitz does not support window.open() properly
System Information
Steps to reproduce the behavior
StackBlitz unfortuantely always returns null when calling
window.open()
, but here is the code:Expected behavior
In popup windows, menu should just behave as in the normal browser window, i.e. close when clicking outside of the window
The text was updated successfully, but these errors were encountered: