Skip to content

Commit 7371487

Browse files
authored
Fix icon inline-size for better compatibility with older browsers (#2142)
* Fix icon inline-size for better compatibility with older browsers * added changeset
1 parent 51f596d commit 7371487

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

.changeset/smart-seas-enjoy.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sl-design-system/icon': patch
3+
---
4+
5+
Added a fallback for older browser because when the unit `cap` isn't supported. In those browsers the icons became VERY big.

packages/components/icon/src/icon.scss

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,19 @@
66
aspect-ratio: 1 / 1;
77
display: inline-grid;
88
flex-shrink: 0; // Prevent shrinking in flex containers
9-
inline-size: max(1cap, var(--sl-icon-size));
9+
inline-size: max(0.8em, var(--sl-icon-size));
1010
outline: none;
1111
place-content: center;
1212
translate: 0;
1313
}
1414

15+
// There are some really old browsers that don't support `cap` yet, so we use a fallback with `em`.
16+
@supports (inline-size: 1cap) {
17+
:host {
18+
inline-size: max(1cap, var(--sl-icon-size));
19+
}
20+
}
21+
1522
:host([size='2xs']) {
1623
--sl-icon-size: var(--sl-size-125);
1724
}

0 commit comments

Comments
 (0)