Skip to content

Commit 1d55b46

Browse files
committed
fix: enhance Safari rendering
1 parent 6c28337 commit 1d55b46

File tree

5 files changed

+19
-2
lines changed

5 files changed

+19
-2
lines changed

demo-tailwind/src/main.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,8 @@ body {
1010
"Segoe UI",
1111
sans-serif;
1212
}
13+
14+
/* Safari: stabilize drop-shadow during scroll */
15+
[class*="drop-shadow-effective"] {
16+
will-change: filter;
17+
}

demo/src/App.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,12 @@ function SectionBoxVsDrop() {
293293
<code>filter: drop-shadow()</code> — it's the only option that follows
294294
non-rectangular shapes.
295295
</p>
296+
<p>
297+
<strong>Safari tip:</strong> Add <code>will-change: filter</code> to
298+
elements using <code>drop-shadow()</code> to prevent rendering
299+
glitches during scroll. This promotes the element to its own
300+
compositing layer.
301+
</p>
296302
</div>
297303

298304
<div className="prose" style={{ marginTop: 32 }}>

demo/src/components/ComparisonTechniques.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ function ComparisonColumn({
2828
className="comparison-card"
2929
style={{
3030
boxShadow: item.boxShadow,
31-
filter: item.filter
31+
filter: item.filter,
32+
// Safari: stabilizes drop-shadow during scroll
33+
willChange: item.filter ? "filter" : undefined
3234
}}
3335
>
3436
<span>{item.name}</span>

demo/src/components/Playground.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,10 @@ const dropShadow = toDropShadow(shadow${colorArg})`
339339
<div className="playground-preview">
340340
<div
341341
className="playground-card"
342-
style={{ filter: dropShadowCSS }}
342+
style={{
343+
filter: dropShadowCSS,
344+
willChange: "filter" // Safari: stabilizes drop-shadow during scroll
345+
}}
343346
/>
344347
</div>
345348
</div>

demo/src/style.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,6 +1332,7 @@ body {
13321332
.glow-btn-filter {
13331333
box-shadow: none;
13341334
filter: var(--btn-filter);
1335+
will-change: filter; /* Safari: stabilizes drop-shadow during scroll */
13351336
}
13361337

13371338
.glow-btn:hover {

0 commit comments

Comments
 (0)