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; }
<rdar://problem/103887993>
Thanks for the bug report! This is still reproducible on trunk WebKit.
Created attachment 464475 [details] Patch
Created attachment 464476 [details] Screen recording with the patch applied
Created attachment 464502 [details] Patch
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].