Skip to content

Commit

Permalink
add more backdrop selectors to properly inherit theme colors (#2549)
Browse files Browse the repository at this point in the history
* add more backdrop selectors to properly inherit theme colors

* changeset
  • Loading branch information
keithamus authored Nov 17, 2023
1 parent 4518cc4 commit df764e1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/popular-hounds-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/css': patch
---

Fix styles for ::backdrop
22 changes: 21 additions & 1 deletion src/support/mixins/color-modes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
}

::backdrop,
[data-color-mode="light"][data-light-theme="#{$theme-name}"],
[data-color-mode="light"][data-light-theme="#{$theme-name}"]::backdrop,
[data-color-mode="dark"][data-dark-theme="#{$theme-name}"]::backdrop {
@content;

Expand All @@ -47,6 +47,14 @@
@content;
}
}

::backdrop,
[data-color-mode="light"][data-light-theme="#{$theme-name}"]::backdrop,
[data-color-mode="dark"][data-dark-theme="#{$theme-name}"]::backdrop {
@content;

/*! */ // Must remain separate from the above selector to not break browsers which don't support ::backdrop, e.g. Safari 14.
}
}

@media (prefers-color-scheme: light) {
Expand All @@ -56,6 +64,12 @@
@content;
}
}

[data-color-mode="auto"][data-light-theme="#{$theme-name}"]::backdrop {
@content;

/*! */ // Must remain separate from the above selector to not break browsers which don't support ::backdrop, e.g. Safari 14.
}
}

@media (prefers-color-scheme: dark) {
Expand All @@ -65,6 +79,12 @@
@content;
}
}

[data-color-mode="auto"][data-light-theme="#{$theme-name}"]::backdrop {
@content;

/*! */ // Must remain separate from the above selector to not break browsers which don't support ::backdrop, e.g. Safari 14.
}
}
}

Expand Down

0 comments on commit df764e1

Please sign in to comment.