Skip to content

Commit df764e1

Browse files
authored
add more backdrop selectors to properly inherit theme colors (#2549)
* add more backdrop selectors to properly inherit theme colors * changeset
1 parent 4518cc4 commit df764e1

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

.changeset/popular-hounds-sin.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/css': patch
3+
---
4+
5+
Fix styles for ::backdrop

src/support/mixins/color-modes.scss

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
}
3232

3333
::backdrop,
34-
[data-color-mode="light"][data-light-theme="#{$theme-name}"],
34+
[data-color-mode="light"][data-light-theme="#{$theme-name}"]::backdrop,
3535
[data-color-mode="dark"][data-dark-theme="#{$theme-name}"]::backdrop {
3636
@content;
3737

@@ -47,6 +47,14 @@
4747
@content;
4848
}
4949
}
50+
51+
::backdrop,
52+
[data-color-mode="light"][data-light-theme="#{$theme-name}"]::backdrop,
53+
[data-color-mode="dark"][data-dark-theme="#{$theme-name}"]::backdrop {
54+
@content;
55+
56+
/*! */ // Must remain separate from the above selector to not break browsers which don't support ::backdrop, e.g. Safari 14.
57+
}
5058
}
5159

5260
@media (prefers-color-scheme: light) {
@@ -56,6 +64,12 @@
5664
@content;
5765
}
5866
}
67+
68+
[data-color-mode="auto"][data-light-theme="#{$theme-name}"]::backdrop {
69+
@content;
70+
71+
/*! */ // Must remain separate from the above selector to not break browsers which don't support ::backdrop, e.g. Safari 14.
72+
}
5973
}
6074

6175
@media (prefers-color-scheme: dark) {
@@ -65,6 +79,12 @@
6579
@content;
6680
}
6781
}
82+
83+
[data-color-mode="auto"][data-light-theme="#{$theme-name}"]::backdrop {
84+
@content;
85+
86+
/*! */ // Must remain separate from the above selector to not break browsers which don't support ::backdrop, e.g. Safari 14.
87+
}
6888
}
6989
}
7090

0 commit comments

Comments
 (0)