Skip to content

Conversation

NickMonster
Copy link

Defect Fixes

Fixes #7521

When MultiSelect is used inside a shadow root, clicks inside the overlay are not detected correctly. The existing isOutsideClicked method relies on event.target and contains(), which don’t behave as expected across shadow DOM boundaries. As a result, interactions inside the overlay (e.g., clicking the filter input or selecting an option) are treated as outside clicks, causing the overlay to close unexpectedly.

In contrast, the Select component already handles this properly by using event.composedPath() to determine whether the click originated from inside the component or its overlay.

Suggested fix

Unify the behavior between MultiSelect and Select by replacing the isOutsideClicked check with logic based on event.composedPath(). This ensures correct event target detection both in the light DOM and shadow DOM contexts.

@cagataycivici
Copy link
Member

This code is very specific to MultiSelect, a future update to primeuix/theming will support shadow dom instead of case by case changes.

@NickMonster
Copy link
Author

You’re right that the current code is very specific to MultiSelect. However, this is also about fixing a bug: other components like Select and DatePicker already use composedPath to correctly detect outside clicks, while MultiSelect doesn’t. This PR doesn’t introduce anything new — it just applies the same solution you’ve already used elsewhere, ensuring consistency and covering one of the more commonly used components for shadow DOM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve Shadow DOM Support
2 participants