Skip to content

feat!: Reset inherited styles inside shadow root - #1269

Merged
aklinker1 merged 1 commit into
0.20.0-breaking-changesfrom
shadow-root-reset
Dec 11, 2024
Merged

aklinker1 merged 1 commit into
0.20.0-breaking-changesfrom
shadow-root-reset

Conversation

@aklinker1

@aklinker1 aklinker1 commented Dec 11, 2024 •

Copy link
Copy Markdown
Member

BREAKING CHANGE: Before, if you use createShadowRootUi, some styles set on the webpage's html element would effect your UI in the shadow root. By default, WXT now applies a CSS reset to prevent your UI from inheriting any styles from the webpage.

Double check that your createShadowRootUI UIs are styled properly. If not:

  • Continue inheriting styles like before by passing inheritStyles: true:
    const ui = await createShadowRootUi({
    + inheritStyles: true,
      // ...
    })
  • Remove any manual resets for styles that were effecting your UI. For example:
    /* entrypoints/reddit.content/styles.css */
    - body {
    -   /* Override Reddit's default "hidden" visibility */
    -   visibility: visible !important;
    - }

This is a fairly low-impact breaking change. If you needed this reset, you were probably already doing it yourself and this will have no effect. If you didn't need to reset any styles, this shouldn't have any effect.


This closes #1195.

@aklinker1 aklinker1 self-assigned this Dec 11, 2024
@codecov

codecov Bot commented Dec 11, 2024 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.

Project coverage is 79.96%. Comparing base (236e099) to head (a929ced).
Report is 22 commits behind head on 0.20.0-breaking-changes.

Files with missing lines Patch % Lines
...ges/wxt/src/utils/content-script-ui/shadow-root.ts 71.42% 2 Missing ⚠️
Additional details and impacted files
@@                     Coverage Diff                     @@
##           0.20.0-breaking-changes    #1269      +/-   ##
===========================================================
- Coverage                    80.24%   79.96%   -0.29%     
===========================================================
  Files                          127      126       -1     
  Lines                         6070     5964     -106     
  Branches                      1020      998      -22     
===========================================================
- Hits                          4871     4769     -102     
+ Misses                        1184     1178       -6     
- Partials                        15       17       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aklinker1
aklinker1 marked this pull request as ready for review December 11, 2024 21:42
@aklinker1 aklinker1 mentioned this pull request Dec 11, 2024
26 of 28 tasks
@aklinker1 aklinker1 changed the title feat!: Reset inherited styles inside shadow root automatically feat!: Reset inherited styles inside shadow root Dec 11, 2024
@aklinker1
aklinker1 merged commit 2de70e7 into 0.20.0-breaking-changes Dec 11, 2024
@aklinker1
aklinker1 deleted the shadow-root-reset branch December 11, 2024 21:51
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