Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support injection into shadow DOM components #104

Open
rxliuli opened this issue Jan 4, 2025 · 0 comments · May be fixed by #105
Open

feat: Support injection into shadow DOM components #104

rxliuli opened this issue Jan 4, 2025 · 0 comments · May be fixed by #105
Labels
enhancement New feature or request

Comments

@rxliuli
Copy link

rxliuli commented Jan 4, 2025

Describe the feature in detail (code, mocks, or screenshots encouraged)

When I develop browser plugins to inject UI into web pages, I usually choose to use shadow DOM as a CSS isolation solution, while JavaScript is not isolated, so it will by default modify the class of the root document of the web page. Is it possible to add a property similar to the Dialog component in shadcn/ui that allows configuring the modification of a specific shadow DOM's document?

image

Current solution

import { ModeWatcher, mode } from 'mode-watcher'

$effect(() => {
    const root = document
      .querySelector('mass-block-twitter')
      ?.shadowRoot?.querySelector('html')
    const current = $mode
    if (root) {
      root.className = `color-scheme: ${current}`
    }
  })

What type of pull request would this be?

Enhancement

Provide relevant links or additional information.

shadcn/ui Dialog: https://next.bits-ui.com/docs/components/dialog#dialogportal

@rxliuli rxliuli added the enhancement New feature or request label Jan 4, 2025
rxliuli added a commit to rxliuli/mode-watcher that referenced this issue Jan 4, 2025
@rxliuli rxliuli linked a pull request Jan 4, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant