Skip to content

Add support for Shadow DOM parents - #646

Open
dermotduffy wants to merge 1 commit into
timmywil:mainfrom
dermotduffy:shadow-dom-parent
Open

Add support for Shadow DOM parents#646
dermotduffy wants to merge 1 commit into
timmywil:mainfrom
dermotduffy:shadow-dom-parent

Conversation

@dermotduffy

Copy link
Copy Markdown

PR Checklist

Please review the guidelines for contributing to this repository.

  • I am requesting to pull a topic/feature/bugfix branch (right side). In other words, not main.
  • I have run yarn test against my changes and tests pass.
  • I have added tests to prove my fix is effective or my feature works. This can be done in the form of unit tests in test/unit/ or a new or altered demo in demo/.
  • I have added or edited necessary types and generated documentation (yarn docs), or no docs changes are needed.

Description

Add support for the parent element being a Shadow Root host. Right now, this library will support elements in Shadow DOM, but not if the parent element is the shadow root host (i.e. use of this library at the top-level of a web component).

Also includes very minor typing fixes/clarifications.

Fixes: #

@dermotduffy

Copy link
Copy Markdown
Author

@timmywil Gentle ping -- any thoughts on this PR?

Panzoom already works inside shadow DOM, but not when the element's parent
is the shadow root host -- i.e. when the library is used at the top level of
a web component. Resolve the parent via `getParentElement`, which falls back
to the shadow root host, in place of reading `parentNode` directly.
@dermotduffy

Copy link
Copy Markdown
Author

PR updated for June 2026. Still valid.

dermotduffy added a commit to dermotduffy/panzoom that referenced this pull request Jul 27, 2026
This fork carries shadow root host support, which upstream has not taken
(timmywil#646). Rename so it can be published alongside the upstream
package.
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.

1 participant