Bug 227224 - Text disappears for multiple seconds when font requested but load interrupted
Summary: Text disappears for multiple seconds when font requested but load interrupted
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Text (show other bugs)
Version: Safari 14
Hardware: All All
: P2 Trivial
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-06-21 10:52 PDT by ian
Modified: 2021-06-28 10:53 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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>