Menu closes itself immediately when the menu and its button toggle is inside ShadowDom #16298
Labels
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
Describe the bug
p-menu
cannot be opened when the menu and its button toggle is inside ShadowDom encapsulation. The menu closes itself right away.This seems to be caused by
bindDocumentClickListener
. Inside the shadow dom,event.target
will be the shadow root even if the button itself is clicked, soisOutsideContainer
andisOutsideTarget
are always true. It might need to check if the event is composed and if the toggle element contains the first element of the event's composed path (event.composed ? toggleElement.contains(event.composedPath()[0]) : toggleElement.contains(event.target)
).Environment
Angular app with PrimeNG
Reproducer
https://stackblitz.com/edit/github-fhq1jp?file=src%2Fapp%2Fapp.component.html
Angular version
17.3.7
PrimeNG version
17.18.8
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
21.7.1
Browser(s)
No response
Steps to reproduce the behavior
hide()
function.hide()
.Expected behavior
p-menu
should stay opened.The text was updated successfully, but these errors were encountered: