RESOLVED FIXED 250059
box-shadow does not paint correctly on inline elements
https://bugs.webkit.org/show_bug.cgi?id=250059
Summary box-shadow does not paint correctly on inline elements
Kevin Yank
Reported 2023-01-03 18:46:23 PST
In Safari 16.2 on macOS 13.1, a display: inline element will fail to paint (or remove) a box-shadow correctly on hover/focus/active. A work-around to force correct (re-)paints is to add a transparent outline of sufficient size to the same element(s). Minimal demo: https://codepen.io/kevinyank/pen/rNrLEYa HTML: <p>In Safari 16.2 on macOS 13.1, a <code>display: inline</code> element (such as <a href="https://example.com/">this link</a>) will fail to paint (or remove) a <code>box-shadow</code> correctly on hover/focus/active unless an <code>outline</code> (even a transparent one) covering the same area is applied to the element too.</p> <p>To reproduce, hover or tab over/out of the link and observe the incomplete repaints (particularly for the areas outside of the surrounding block). To force a full, correct paint, try zooming in/out (⌘+/-) with the link focused. Then tab away from the link to see part of the painted outline fail to be removed in the repaint.</p> CSS: a:is(:hover, :focus) { box-shadow: 0 0 0 5px red; outline: none; /* work-around: add a large enough transparent outline: */ /*outline: 10px solid transparent;*/ } /* Not necessary for the bug, but just to show that the painting is not cropping of overflow content. */ p, a { overflow: visible; }
Attachments
Patch (5.02 KB, patch)
2023-01-12 17:08 PST, zalan
no flags
Screen recording with the patch applied (834.56 KB, video/quicktime)
2023-01-12 17:10 PST, zalan
no flags
Patch (5.02 KB, patch)
2023-01-14 12:32 PST, zalan
no flags
Radar WebKit Bug Importer
Comment 1 2023-01-04 14:15:14 PST
zalan
Comment 2 2023-01-04 14:18:53 PST
Thanks for the bug report! This is still reproducible on trunk WebKit.
zalan
Comment 3 2023-01-12 17:08:22 PST
zalan
Comment 4 2023-01-12 17:10:08 PST
Created attachment 464476 [details] Screen recording with the patch applied
zalan
Comment 5 2023-01-14 12:32:53 PST
EWS
Comment 6 2023-01-14 16:33:04 PST
Committed 258923@main (003ff7e2ae82): <https://commits.webkit.org/258923@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 464502 [details].
Note You need to log in before you can comment on or make changes to this bug.