Skip to content

Feat/teleport shadow root#18280

Open
TobyMosque wants to merge 4 commits intoquasarframework:devfrom
TobyMosque:feat/teleport-shadow-root
Open

Feat/teleport shadow root#18280
TobyMosque wants to merge 4 commits intoquasarframework:devfrom
TobyMosque:feat/teleport-shadow-root

Conversation

@TobyMosque
Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Documentation
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes
  • No

The PR fulfills these requirements:

  • It's submitted to the dev branch (or v[X] branch)
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix: #xxx[,#xxx], where "xxx" is the issue number)
  • It's been tested on a Cordova (iOS, Android) app
  • It's been tested on an Electron app
  • Any necessary documentation has been added or updated in the docs or explained in the PR's description.

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to start a new feature discussion first and wait for approval before working on it)

Other information:

Config Root Element (config.root)

This PR introduces the config.root property to the Quasar plugin configuration allowing developers to customize the DOM attachment point (defaulting to document.body) for Quasar teleported components (QDialog, QMenu, QSelect, QTooltip, etc).

Why is this needed?

The primary driver for this feature is robust support for Micro Front-ends / Web Components encapsulated in Shadow DOM. Prior to this change, teleporting overlays to document.body aggressively broke component CSS encapsulation since the appended overlay fell outside the Shadow Root, losing access to local CSS Variables and Quasar styles loaded within the custom element instance.

By passing the custom element's shadowRoot via config.root, the overlays seamlessly remain inside the boundaries of the Web Component.

Content of the PR

  • Implementation of the config.root attachment logic across Quasar global components and utilities.
  • Introduction of the Root Element section within the documentation explaining typical and Web Component usages.
  • Menu linkage to expose the new article.

This commit introduces a configurable root element for Quasar global nodes to support proper teleportation inside isolated Shadow DOM hierarchies (e.g. Micro Frontends).

- Add `getRootElement()` to dynamically resolve the configured teleport root.
- Fix `document.body` hardcoded references in node appending mechanisms (nodes.js, QDialog, QTooltip, TouchRepeat, use-fullscreen).
- Add robust defensive checks for `ShadowRoot` resolution on `classList` mutations in the Dark plugin and CSS variables utilities (falling back to `ShadowRoot.host`).
- Inject `:host` alongside `:root` in Quasar's core Sass payload to guarantee CSS variable inheritance across Shadow DOM boundaries.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 30, 2026

UI Tests Results

    1 files     98 suites   40s ⏱️
1 031 tests 1 031 ✅ 0 💤 0 ❌
1 050 runs  1 050 ✅ 0 💤 0 ❌

Results for commit ba3c24f.

♻️ This comment has been updated with latest results.

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