Skip to content

Commit c1104df

Browse files
fix: textarea "responsiveness" due to CSS selector (#5574)
* refactor: simplified selector * refactor: simplified declaration * Update default-required.scss * Update default-required.scss * Change color-scheme selector to :root * refactor: another try * Add CSS variable for color scheme options * Fix textarea responsiveness due to CSS selector * Update tasty-tips-suffer.md * Update default-required.scss * refactor: another try * refactor: trying another approach * Update default-required.scss * Apply suggestions from code review --------- Co-authored-by: Michael Kraus <[email protected]>
1 parent 254a705 commit c1104df

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

.changeset/tasty-tips-suffer.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@db-ux/core-components": patch
3+
"@db-ux/ngx-core-components": patch
4+
"@db-ux/react-core-components": patch
5+
"@db-ux/wc-core-components": patch
6+
"@db-ux/v-core-components": patch
7+
---
8+
9+
fix(textarea): "responsiveness" due to CSS selector

packages/foundations/scss/defaults/default-required.scss

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,23 @@
3434
}
3535

3636
// We'll set the color scheme (https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme) to light and dark if it's not already set as a meta tag in the head, which would be the recommended way.
37-
html:not(:has(> head > meta[name="color-scheme"])) {
38-
color-scheme: light dark;
37+
:root {
38+
color-scheme: var(--db-color-scheme, light dark);
39+
}
40+
41+
// We need to set the CSS value based on an existing HTML meta tag definition because the previous CSS definition would override that HTML declaration.
42+
head {
43+
&:has([name="color-scheme"][content*="light"][content*="dark"]) + body {
44+
--db-color-scheme: light dark;
45+
}
46+
47+
&:has([name="color-scheme"][content="light"]) + body {
48+
--db-color-scheme: light;
49+
}
50+
51+
&:has([name="color-scheme"][content="dark"]) + body {
52+
--db-color-scheme: dark;
53+
}
3954
}
4055

4156
/* TODO: Switch to attr() as soon as this one is fully supported */
@@ -67,7 +82,9 @@ body {
6782
}
6883

6984
// Box sizing
70-
html {
85+
*,
86+
::before,
87+
::after {
7188
box-sizing: var(--db-box-sizing, border-box);
7289
}
7390

@@ -79,12 +96,6 @@ html {
7996
text-rendering: optimizelegibility;
8097
}
8198

82-
*,
83-
::before,
84-
::after {
85-
box-sizing: inherit;
86-
}
87-
8899
// Make sure every elements has the current color from container above
89100
body,
90101
button,

0 commit comments

Comments
 (0)