Bug 227224

Summary: Text disappears for multiple seconds when font requested but load interrupted
Product: WebKit Reporter: ian
Component: TextAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Trivial CC: mmaxfield, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 14   
Hardware: All   
OS: All   
See Also: https://bugs.webkit.org/show_bug.cgi?id=227143

Description ian 2021-06-21 10:52:16 PDT
In Safari/Mobile Safari 14 text stops rendering for a several seconds in an peculiar circumstance:

• Nothing on the page initially needed a font specified in @font-face.
• A style was changed such that that font is now needed, triggering the lazy load.
• The font-face in question has font-display:auto.
• The font download is ~interrupted~ after it's requested.

In Chrome, Firefox, and earlier versions of Safari there is an observable but brief 'blink' (maybe ~250ms), but in Safari 14 the disappearance can be several seconds long

Reproduction is here: http://ianbellomy.com/test/font-failure-test.html

(Note that caching may eliminate the issue if the page is refreshed.)

Admittedly the situation is pretty peculiar but it also seems like 'auto' should not lead to a behavior like this. 

FWIW, I ran into this after having done something bone-headed but it seems possible to inadvertently hit this in a large project, if, through some project change, a font is no longer needed on initial presentation, and additional network traffic is needed to properly display the site. In a PWA type situation for example a user might install the PWA but not hit an area that needs a font until they go to use the PWA while offline. I haven't tested for a 'failed' response though (opposed to an interruption).
Comment 1 Radar WebKit Bug Importer 2021-06-28 10:53:14 PDT
<rdar://problem/79871859>