Skip to content
Discussion options

You must be logged in to vote

@ptdatta the issue is WXT's default cssInjectionMode which is "manifest". this causes all CSS from your content script bundle (including any CSS imports, tailwind base styles, resets, etc.) to be injected globally into YouTube's page via the manifest's css array. that overrides YouTube's own styles, breaking the entire UI.

two things to fix:

  1. set cssInjectionMode to "ui" or "manual" to prevent global CSS injection:
export default defineContentScript({
  matches: ["*://*.youtube.com/*"],
  cssInjectionMode: "ui",
  async main(ctx) {
    // your code here
  },
});
  1. use createShadowRootUi instead of raw ReactDOM.createRoot to isolate your injected UI's styles inside a Shadow DOM. this preve…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by PatrykKuniczak
Comment options

You must be logged in to vote
1 reply
@sunnypatell
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants