Skip to content

Commit

Permalink
Support web components/shadow DOM.
Browse files Browse the repository at this point in the history
Add :host to all uses of :root
  • Loading branch information
rcoup committed Dec 2, 2024
1 parent 6dc6489 commit 60f8632
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion scss/colors/utilities/_css-vars.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
$css-var-color-prefix: #{settings.$css-var-prefix}#{$color-property-name};

@if $enable-css-vars {
:root {
:root, :host {
// Loop through color families
@each $family, $colors in colors.$colors {
@if index(map.get(settings.$palette, "color-families"), $family) {
Expand Down
2 changes: 1 addition & 1 deletion scss/components/_modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Modal (<dialog>)
*/

:root {
:root, :host {
#{$css-var-prefix}scrollbar-width: 0px;
}

Expand Down
5 changes: 3 additions & 2 deletions scss/content/_embedded.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
}

// Hide the overflow in IE
#{$parent-selector} svg:not(:root) {
overflow: hidden;
#{$parent-selector} svg:not(:root),
#{$parent-selector} svg:not(:host) {
overflow: hidden;
}
}
2 changes: 1 addition & 1 deletion scss/layout/_document.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
// 3. Use a 4-space tab width in all browsers (opinionated)
// 4. Remove the grey highlight on links in iOS (opinionated)
// 5. Prevent adjustments of font size after orientation changes in iOS
:where(:root) {
:where(:root), :where(:host) {
-webkit-tap-highlight-color: transparent; // 4
-webkit-text-size-adjust: 100%; // 5
text-size-adjust: 100%; // 5
Expand Down
8 changes: 5 additions & 3 deletions scss/themes/default/_schemes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@
// Light color scheme (Default)
// Can be forced with data-theme="light"
[data-theme="light"],
:root:not([data-theme="dark"]) {
:root:not([data-theme="dark"]),
:host:not([data-theme="dark"]) {
@include light.theme;
}

// Dark color scheme (Auto)
// Automatically enabled if user has Dark mode enabled
@media only screen and (prefers-color-scheme: dark) {
:root:not([data-theme]) {
@include dark.theme;
:root:not([data-theme]),
:host:not([data-theme]) {
@include dark.theme;
}
}

Expand Down
2 changes: 1 addition & 1 deletion scss/themes/default/_styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Styles
*/

:root {
:root, :host {
// Typography
#{$css-var-prefix}font-family-emoji: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
"Noto Color Emoji";
Expand Down

0 comments on commit 60f8632

Please sign in to comment.