Skip to content

Commit 3e57249

Browse files
authored
fix(styles): use valid media query (#20003)
* fix(styles): use valid media query * fix(styles): update safari styles in loading, tabs, and tile
1 parent ddd3947 commit 3e57249

File tree

5 files changed

+50
-55
lines changed

5 files changed

+50
-55
lines changed

packages/styles/scss/components/code-snippet/_code-snippet.scss

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -508,15 +508,14 @@ $copy-btn-feedback: $background-inverse !default;
508508
// Safari-only media query
509509
// since fades won't appear correctly with CSS custom properties
510510
// see: tabs, code snippet, and modal overflow indicators
511-
@media not all and (min-resolution >= 0.001dpcm) {
512-
@supports (-webkit-appearance: none) and (stroke-color: transparent) {
513-
.#{$prefix}--snippet__overflow-indicator--left {
514-
background-image: linear-gradient(to left, rgba($layer, 0), $layer);
515-
}
516-
517-
.#{$prefix}--snippet__overflow-indicator--right {
518-
background-image: linear-gradient(to right, rgba($layer, 0), $layer);
519-
}
511+
@supports (hanging-punctuation: first) and (font: -apple-system-body) and
512+
(-webkit-appearance: none) {
513+
.#{$prefix}--snippet__overflow-indicator--left {
514+
background-image: linear-gradient(to left, rgba($layer, 0), $layer);
515+
}
516+
517+
.#{$prefix}--snippet__overflow-indicator--right {
518+
background-image: linear-gradient(to right, rgba($layer, 0), $layer);
520519
}
521520
}
522521

packages/styles/scss/components/loading/_loading.scss

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,11 @@
7676
}
7777

7878
// Negative values for `stroke-dashoffset` are not supported in Safari
79-
@media not all and (resolution >= 0.001dpcm) {
80-
@supports (-webkit-appearance: none) and (stroke-color: transparent) {
81-
circle.#{$prefix}--loading__background {
82-
stroke-dasharray: 265;
83-
stroke-dashoffset: 0;
84-
}
79+
@supports (hanging-punctuation: first) and (font: -apple-system-body) and
80+
(-webkit-appearance: none) {
81+
circle.#{$prefix}--loading__background {
82+
stroke-dasharray: 265;
83+
stroke-dashoffset: 0;
8584
}
8685
}
8786

packages/styles/scss/components/tabs/_tabs.scss

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -258,41 +258,40 @@
258258
// Safari-only media query
259259
// won't appear correctly with CSS custom properties
260260
// see: code snippet and modal overflow indicators
261-
@media not all and (resolution >= 0.001dpcm) {
262-
@supports (-webkit-appearance: none) and (stroke-color: transparent) {
261+
@supports (hanging-punctuation: first) and (font: -apple-system-body) and
262+
(-webkit-appearance: none) {
263+
.#{$prefix}--tabs__overflow-indicator--left {
264+
background-image: linear-gradient(
265+
to left,
266+
rgba($background, 0),
267+
$background
268+
);
269+
}
270+
271+
.#{$prefix}--tabs__overflow-indicator--right {
272+
background-image: linear-gradient(
273+
to right,
274+
rgba($background, 0),
275+
$background
276+
);
277+
}
278+
279+
&.#{$prefix}--tabs--contained
263280
.#{$prefix}--tabs__overflow-indicator--left {
264-
background-image: linear-gradient(
265-
to left,
266-
rgba($background, 0),
267-
$background
268-
);
269-
}
281+
background-image: linear-gradient(
282+
to left,
283+
rgba($layer-accent, 0),
284+
$layer-accent
285+
);
286+
}
270287

288+
&.#{$prefix}--tabs--contained
271289
.#{$prefix}--tabs__overflow-indicator--right {
272-
background-image: linear-gradient(
273-
to right,
274-
rgba($background, 0),
275-
$background
276-
);
277-
}
278-
279-
&.#{$prefix}--tabs--contained
280-
.#{$prefix}--tabs__overflow-indicator--left {
281-
background-image: linear-gradient(
282-
to left,
283-
rgba($layer-accent, 0),
284-
$layer-accent
285-
);
286-
}
287-
288-
&.#{$prefix}--tabs--contained
289-
.#{$prefix}--tabs__overflow-indicator--right {
290-
background-image: linear-gradient(
291-
to right,
292-
rgba($layer-accent, 0),
293-
$layer-accent
294-
);
295-
}
290+
background-image: linear-gradient(
291+
to right,
292+
rgba($layer-accent, 0),
293+
$layer-accent
294+
);
296295
}
297296
}
298297

packages/styles/scss/components/tag/_tag.scss

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,9 @@
381381
inline-size: convert.to-rem(60px);
382382

383383
// Safari specific bug (#7672)
384-
@media not all and (min-resolution >= 0.001dpcm) {
385-
@supports (-webkit-appearance: none) and (stroke-color: transparent) {
386-
transform: translateZ(0);
387-
}
384+
@supports (hanging-punctuation: first) and (font: -apple-system-body) and
385+
(-webkit-appearance: none) {
386+
transform: translateZ(0);
388387
}
389388
}
390389

packages/styles/scss/components/tile/_tile.scss

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,9 @@ $-icon-container-size: calc(#{layout.density('padding-inline')} * 2 + 1rem);
316316
// Safari-only media query
317317
// Fixes an issue with scrolling
318318
// and absolutely positioned elements (#8119)
319-
@media not all and (resolution >= 0.001dpcm) {
320-
@supports (-webkit-appearance: none) and (stroke-color: transparent) {
321-
overflow-y: auto;
322-
}
319+
@supports (hanging-punctuation: first) and (font: -apple-system-body) and
320+
(-webkit-appearance: none) {
321+
overflow-y: auto;
323322
}
324323
}
325324
}

0 commit comments

Comments
 (0)