From df764e1a617d13af34d97bd7b4f06b8a478facd2 Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Fri, 17 Nov 2023 16:44:44 +0100 Subject: [PATCH] add more backdrop selectors to properly inherit theme colors (#2549) * add more backdrop selectors to properly inherit theme colors * changeset --- .changeset/popular-hounds-sin.md | 5 +++++ src/support/mixins/color-modes.scss | 22 +++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 .changeset/popular-hounds-sin.md diff --git a/.changeset/popular-hounds-sin.md b/.changeset/popular-hounds-sin.md new file mode 100644 index 0000000000..56e3614d67 --- /dev/null +++ b/.changeset/popular-hounds-sin.md @@ -0,0 +1,5 @@ +--- +'@primer/css': patch +--- + +Fix styles for ::backdrop diff --git a/src/support/mixins/color-modes.scss b/src/support/mixins/color-modes.scss index 0ca2b89a31..ea1bf4e451 100644 --- a/src/support/mixins/color-modes.scss +++ b/src/support/mixins/color-modes.scss @@ -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; @@ -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) { @@ -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) { @@ -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. + } } }