[wp-trac] [WordPress Trac] #58454: script-loader.php doesn't support font-display: optional, that is recommended for performance

WordPress Trac noreply at wordpress.org
Mon Jun 5 03:00:39 UTC 2023


#58454: script-loader.php doesn't support font-display: optional, that is
recommended for performance
---------------------------+------------------------------
 Reporter:  asafm7         |       Owner:  (none)
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Script Loader  |     Version:
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:  performance
---------------------------+------------------------------
Changes (by sabernhardt):

 * component:  General => Script Loader


Old description:

> script-loader.php doesn't support font-display: optional, which is
> recommended by Google to reduce CLS.
>
> Current code:
>
> {{{
>         // Check the font-display.
>         if (!in_array($webfont['font-display'], array('auto', 'block',
> 'fallback', 'swap'), true)) {
>             $webfont['font-display'] = 'fallback';
>         }
> }}}
>
> font-display: optional combined with https://web.dev/preload-optional-
> fonts/ is recommended by Google to reduce CLS:
>
> https://web.dev/preload-optional-fonts/

New description:

 script-loader.php doesn't support `font-display: optional`, which is
 recommended by Google to reduce Cumulative Layout Shift.

 Current code:

 {{{
         // Check the font-display.
         if ( ! in_array( $webfont['font-display'], array( 'auto', 'block',
 'fallback', 'swap' ), true ) ) {
             $webfont['font-display'] = 'fallback';
         }
 }}}

 `font-display: optional` combined with `rel="preload"` is recommended by
 Google to reduce CLS:
 https://web.dev/preload-optional-fonts/

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58454#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list