Google fonts don't load when enqueued late #3932
Labels
Module: Idea Hub
Google Idea Hub module related issues
P1
Medium priority
Type: Bug
Something isn't working
Milestone
Bug Description
As discovered in #3625 (comment), when we try to enqueue Google fonts after
(wp|admin)_head
, the fonts end up not being loaded due to some odd legacy behavior around how they are enqueued.We currently load our fonts primarily using the JS-based web font loader and secondarily using CSS if the site is using AMP. This is overly complex and not necessary for our use which is largely the reason for the problem here.
We should update our fonts to be loaded as a dependency of our main/base styles using CSS as is the recommended/primary approach in the Google font docs.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
fonts.googleapis.com/css
regardless of the AMP modeAssets::enqueue_fonts
method should be deprecated for removal in the future but updated to continue to work similar to before (without theWebFontConfig
variant though)Assets::enqueue_fonts
should be removedgooglesitekit_font_families
filterWebFontConfig
used in Storybook should be replaced with a stylesheet tag for consistencyImplementation Brief
enqueue_fonts
and the changes to Storybookpreview-head.html
Test Coverage
enqueue_fonts
becoming deprecatedVisual Regression Changes
QA Brief
Changelog entry
The text was updated successfully, but these errors were encountered: