Repository navigation
Font Library: keep deactivated theme font variants listed - #82091
Mayank-Tripathi32 wants to merge 4 commits into
Conversation
The font details view renders one row per entry in the selected font's fontFace array, while each row's checkbox state is derived separately from the activated fonts. Deactivating a variant removes it from the user's global styles, so looking the selected theme font up in the activated list meant the row for a deactivated variant disappeared and could never be re-checked. Deactivating every variant dropped the whole family. Look theme fonts up in the theme's own font families merged with the activated ones, mirroring what installed-fonts already does for the list. Merging rather than replacing keeps fonts that only an applied style variation defines.
The list concatenated only the families missing from the user's global styles, so a family with some variants deactivated kept its shrunken user entry and the card reported '2 of 2 active' for a font the theme ships three variants of. Use the same variant-level merge the details view now uses, so the card counts what the theme offers.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Pull request overview
Keeps deactivated theme font variants available in the Font Library for reactivation.
Changes:
- Merges base and active theme fonts at the variant level.
- Uses merged fonts for details and accurate active-variant counts.
- Documents the fix.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
installed-fonts.tsx |
Lists and counts all theme variants. |
context.tsx |
Selects fonts from merged theme data. |
CHANGELOG.md |
Records the bug fix. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Fixes #60392
What?
Keep deactivated theme font variants listed in the Font Library so they can be activated again. Deactivating every variant no longer removes the family from the modal, and the family card counts the variants the theme ships rather than only the activated ones.
Why?
Deactivating a variant removes it from the user's global styles, and both the details-view lookup and the list merge only considered the activated fonts. Unchecking a variant and saving made its row disappear, with no way to re-activate it, and left the card reporting e.g. "2 of 2 active" for a font the theme ships three variants of.
Worth noting for testers: this only reproduces when a strict subset of a multi-variant font is deactivated and the change is saved (Update) before reopening. Deactivating the only variant, or all of them. removes the family from the user's global styles entirely and the base-fonts fallback brings everything back, so single-variant fonts (which most variable fonts are) never show it. Reproduced on current trunk and on WordPress Playground (WP stable) with TT4's Cardo, which ships three variants.
How?
Look theme fonts up in the theme's own (
baseorigin) font families merged with the activated ones, usingmergeFontFamiliesso families are merged at the variant level, both when selecting a font for the details view and when building the Library list. Merging rather than replacing keeps fonts that only an applied style variation defines, which is the constraint described in #60392 (comment).Testing Instructions
On trunk, step 3 shows only two rows and the deactivated variant cannot be restored from the UI.
AI Disclosure?
Before
60392-before-trunk.webm
After
60392-after-fix.webm