Skip to content

What is it? ​

primeng-shadowdom-directives (PSD) is a small Angular library of directives that make PrimeNG overlay components work when your UI lives inside a Shadow DOM, for example ViewEncapsulation.ShadowDom or Angular Elements.

Two separate problems ​

People often mix these up:

ProblemSymptomWho fixes it
Theme CSSButtons / Select look unstyled inside the shadow hostPrimeNG 22+ shares styles with adoptedStyleSheets. On 18-21, clone sheets from document.head (see Styles).
Overlay behaviorMenu / Popover does not dismiss on outside click; scroll parents wrongPSD psd* directives + DomHandler.getScrollableParents patch

PSD has always been about overlays. On v22 we do not ship a CSS clone helper. Use PrimeNG's official style sharing for theming.

How overlays break under Shadow DOM ​

PrimeNG overlays often:

  1. Append panels to document.body (outside your shadow tree).
  2. Listen for “outside” clicks on document.
  3. Use event.target / tree walks that stop at the shadow boundary.

Clicks from inside the shadow host get retargeted. Without composedPath(), the host can look like the click target, so dismiss logic misfires.

PSD directives override the relevant handlers to use path-aware checks.

Prefix ​

All directives use the prefix psd = PrimeNG ShadowDOM Directive (psdMenu, psdPopover, ...).

Next ​

Released under the MIT License.