Skip to content

Commit 0fe73e9

Browse files
authoredFeb 20, 2025··
feat(popover): overflow bug on Safari (#3566)
# Popover overflow bug on Safari browser `translateZ` has been added to popover `&.is-open`. This is to prevent clipping of the `filter: drop-shadow` when `overflow` is applied on `spectrum-Popover`. This bug happens on the Safari browser. `translateZ or translate3d` on the `&.is-open` class accelerates the component to the GPU layer maintaining any transformations and animations. `overflow: visible` applied to CSS `--withTip` so the tip is still visible if `overflow` is applied to the component.

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed
 

‎.changeset/perfect-worms-march.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@spectrum-css/popover": minor
3+
---
4+
5+
# Popover overflow bug on Safari browser
6+
7+
`translateZ` has been added to popover `&.is-open`. This is to prevent clipping of the `filter: drop-shadow` when `overflow` is applied on `spectrum-Popover`. This bug happens on the Safari browser. `translateZ or translate3d` on the `&.is-open` class accelerates the component to the GPU layer maintaining any transformations and animations.
8+
9+
`overflow: visible` applied to CSS `--withTip` so the tip is still visible if `overflow` is applied to the component.

‎components/popover/dist/metadata.json

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
".spectrum-Popover--withTip.spectrum-Popover--top-right .spectrum-Popover-tip",
8484
".spectrum-Popover--withTip.spectrum-Popover--top-start .spectrum-Popover-tip",
8585
".spectrum-Popover.is-open",
86+
".spectrum-Popover.spectrum-Popover--withTip",
8687
".spectrum-Popover.spectrum-Popover--withTip .spectrum-Popover-tip .spectrum-Popover-tip-triangle",
8788
"[dir=\"rtl\"] .spectrum-Popover--end-bottom.is-open",
8889
"[dir=\"rtl\"] .spectrum-Popover--end-top.is-open",

‎components/popover/index.css

+18-8
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@
7575

7676
/* has tip triangle */
7777
&.spectrum-Popover--withTip {
78+
/* Prevents clipping of the tip */
79+
overflow: visible;
80+
7881
.spectrum-Popover-tip {
7982
/* triangle polygon */
8083
.spectrum-Popover-tip-triangle {
@@ -115,7 +118,8 @@
115118

116119
/* popover animates upward ⬆ */
117120
&.is-open {
118-
transform: translateY(calc(-1 * var(--mod-popover-animation-distance, var(--spectrum-popover-animation-distance))));
121+
/* TranslateZ is Safari fix to prevent clipping of filter dropshadow and accelerate the element to GPU layer */
122+
transform: translateY(calc(-1 * var(--mod-popover-animation-distance, var(--spectrum-popover-animation-distance)))) translateZ(0);
119123
}
120124
}
121125

@@ -133,7 +137,8 @@
133137

134138
/* popover animates downward ⬇ */
135139
&.is-open {
136-
transform: translateY(var(--mod-popover-animation-distance, var(--spectrum-popover-animation-distance)));
140+
/* TranslateZ is Safari fix to prevent clipping of filter dropshadow and accelerate the element to GPU layer */
141+
transform: translateY(var(--mod-popover-animation-distance, var(--spectrum-popover-animation-distance))) translateZ(0);
137142
}
138143
}
139144

@@ -150,7 +155,8 @@
150155

151156
/* popover animates towards right ⮕ */
152157
&.is-open {
153-
transform: translateX(var(--mod-popover-animation-distance, var(--spectrum-popover-animation-distance)));
158+
/* TranslateZ is Safari fix to prevent clipping of filter dropshadow and accelerate the element to GPU layer */
159+
transform: translateX(var(--mod-popover-animation-distance, var(--spectrum-popover-animation-distance))) translateZ(0);
154160
}
155161
}
156162

@@ -167,7 +173,8 @@
167173

168174
/* popover animates towards left ⬅ */
169175
&.is-open {
170-
transform: translateX(calc(-1 * var(--mod-popover-animation-distance, var(--spectrum-popover-animation-distance))));
176+
/* TranslateZ is Safari fix to prevent clipping of filter dropshadow and accelerate the element to GPU layer */
177+
transform: translateX(calc(-1 * var(--mod-popover-animation-distance, var(--spectrum-popover-animation-distance)))) translateZ(0);
171178
}
172179
}
173180

@@ -183,12 +190,13 @@
183190

184191
/* LTR read, popover animates towards left ⬅ */
185192
&.is-open {
186-
transform: translateX(calc(-1 * var(--mod-popover-animation-distance, var(--spectrum-popover-animation-distance))));
193+
/* TranslateZ is Safari fix to prevent clipping of filter dropshadow and accelerate the element to GPU layer */
194+
transform: translateX(calc(-1 * var(--mod-popover-animation-distance, var(--spectrum-popover-animation-distance)))) translateZ(0);
187195
}
188196

189197
/* RTL read, popover animates towards right ⮕ */
190198
&.is-open:dir(rtl) {
191-
transform: translateX(var(--mod-popover-animation-distance, var(--spectrum-popover-animation-distance)));
199+
transform: translateX(var(--mod-popover-animation-distance, var(--spectrum-popover-animation-distance))) translateZ(0);
192200
}
193201
}
194202

@@ -204,13 +212,15 @@
204212

205213
/* LTR read, popover animates towards right ⮕ */
206214
&.is-open {
207-
transform: translateX(var(--mod-popover-animation-distance, var(--spectrum-popover-animation-distance)));
215+
/* TranslateZ is Safari fix to prevent clipping of filter dropshadow and accelerate the element to GPU layer */
216+
transform: translateX(var(--mod-popover-animation-distance, var(--spectrum-popover-animation-distance))) translateZ(0);
208217
}
209218

210219
/* RTL read, popover animates towards left ⬅ */
211220
&:dir(rtl) {
212221
&.is-open {
213-
transform: translateX(calc(-1 * var(--mod-popover-animation-distance, var(--spectrum-popover-animation-distance))));
222+
/* TranslateZ is Safari fix to prevent clipping of filter dropshadow and accelerate the element to GPU layer */
223+
transform: translateX(calc(-1 * var(--mod-popover-animation-distance, var(--spectrum-popover-animation-distance)))) translateZ(0);
214224
}
215225
}
216226
}

0 commit comments

Comments
 (0)
Please sign in to comment.