Repository navigation
fix(webfont-loader): point WebfontLoader to the fixed loader - #28
Open
faisalahammad wants to merge 2 commits into
Open
faisalahammad wants to merge 2 commits into
faisalahammad wants to merge 2 commits into
Conversation
Both editor font loaders were broken since 3.7.3 of Kadence Blocks. WebfontLoader built a css2 URL that Google rejects with a 400 for any multi-word family or any family with a weight, and it skipped the load on first mount. KadenceWebfontLoader only read the `config` prop, while the blocks pass `typography`, so it loaded nothing. Point both exports at the fixed loader from simple-webfont-loader. It accepts `typography` or a legacy `config`, builds valid css2 URLs (family=Open+Sans:ital,wght@1,700), loads on mount, and removes fonts the block no longer uses. Remove the broken simple-web-font-loader. Add unit tests for the loader and the URL builder, plus the jest setup to run them. Fixes stellarwp/kadence-blocks#1455
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Comment |
5 of 8 tasks
main already has the KadenceWebfontLoader fix in 1.1.10, so for the shared files (font-request.js, tests, jest config, package files) I took the main version. What is left in this PR: point the WebfontLoader export to the fixed loader and remove the old simple-web-font-loader, which still builds bad Google Fonts URLs. Also keep the test for a multi-word family from a legacy config.
faisalahammad
added a commit
to faisalahammad/kadence-blocks
that referenced
this pull request
Oct 14, 2026
master now pins @kadence/components 1.1.10, which has the KadenceWebfontLoader fix. I keep the fork ref here because the WebfontLoader fix (stellarwp/kadence-components#28) is not in a tag yet. Took @kadence/helpers 1.1.1 from master and regenerated bun.lock.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Google Fonts do not load in the block editor since Kadence Blocks 3.7.3. Version 1.1.10 fixed
KadenceWebfontLoader, but theWebfontLoaderexport still points to the oldsimple-web-font-loader, which builds URLs that Google rejects. This pointsWebfontLoaderto the fixed loader too.Fixes stellarwp/kadence-blocks#1455 (for the blocks that use
WebfontLoader)Changes
src/index.jsBefore:
After:
Why: Countdown, Form, Testimonials, Tabs, Info Box, Progress Bar, Count Up and Advanced Gallery use
WebfontLoader. With this they get the fixed loader, with no change on the blocks side. The fixed loader already reads the legacyconfigprop these blocks pass.src/simple-web-font-loader/index.js(removed)Why: Blocks pass
Open Sans:700italic. This becomesfamily=Open%2BSans%3A700italic, which returns 400. It also skipped the load on first mount. Nothing uses this folder after the export change.src/simple-webfont-loader/__tests__/index.test.jsOne new test: a multi-word family with a variant from a legacy
config(Open Sans:700italic) loadsfamily=Open+Sans:ital,wght@1,700. This is the shapeWebfontLoadercallers send.Testing
Test 1: Unit tests
npm install && npm testResult: the 2 webfont loader suites pass, including the new test.
Test 2: Block editor (Kadence Blocks with this branch)
Result: the font renders in the editor. The request to
fonts.googleapis.com/css2returns 200.Note: anything importing
@kadence/components/src/simple-web-font-loaderdirectly will break, since that folder is removed. I did not find such imports in Kadence Blocks.