-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add defaultFontSizes option to theme.json #56661
Conversation
This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress. If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged. If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack. Thank you! ❤️ View changed files❔ lib/class-wp-theme-json-gutenberg.php ❔ lib/theme.json |
Size Change: +222 B (0%) Total Size: 1.69 MB
ℹ️ View Unchanged
|
ab1cb4a
to
b7fe8e4
Compare
Flaky tests detected in 7ea8c73. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7135196262
|
b7fe8e4
to
6cf601a
Compare
1099861
to
6673c25
Compare
c52dc43
to
aa2e437
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I add a duplicate font size, the first one shows in the list but the second one is actually what gets applied.
aa2e437
to
7ea8c73
Compare
This looks like it exists on trunk too. Generating the global stylesheet doesn't filter out duplicates, so the later CSS overrides the earlier. {
"name": "Display xl2",
"slug": "Display-xl",
"size": "296px"
},
{
"name": "Display xl",
"slug": "Display-xl",
"size": "96px"
}, There's a second bug on trunk. You should be able to override default values because {
"name": "Override Small",
"slug": "small",
"size": "26px"
},
{
"name": "Override Medium",
"slug": "medium",
"size": "40px"
},
{
"name": "Override Large",
"slug": "large",
"size": "72px"
}, It's an issue with global styles, but fixing global styles seems like a separate task, so I recreated the second bug in this PR (and fixed the first bug where overriding yourself shows only the value that will be applied in CSS). At least that way, the experience isn't any worse than it was before. The thing you select should always match the thing in the CSS even if you still can't override the defaults. The problem is that I had to write some hacky code to match the UI with the buggy global styles. This needs more testing, and maybe some cleanup. But I'm out for a few days, so if someone wants to pick it up and bring it to the finish line while I'm away, you're more than welcome to do so. Getting the global styles |
Here's what I found when investigating the duplicate font sizes: #57692 |
Thank you for working on this. Once the code is merged into WP Core please could you
Thank you in advance 🙇 |
I have been advised away from Github, that merging the backport is delayed here due to some concerns regarding compatibility with existing Themes. @ajlende will elaborate when he has more details. |
This PR changed the default value for The value for So both the ordering bug and the legacy behavior both need to be added to fix this issue which is why there are delays. |
Thank you for the update 👍 Let either of the Editor Tech Leads know if you need any support to land the fixes. |
This reverts commit 940f0fe.
* Add defaultFontSizes option for theme.json * Fix defaultFontSizes causing errors when missing * Simplify useMergedSettings * Simplify more * Remove the memo because it's probably fine * Try ignoring how overrides are handled in the dropdown * Minor performance improvement using reverse instead of toReversed * Link to a new issue with a more complete description * Refactor hack into its own funtion
* Add defaultFontSizes option for theme.json * Fix defaultFontSizes causing errors when missing * Simplify useMergedSettings * Simplify more * Remove the memo because it's probably fine * Try ignoring how overrides are handled in the dropdown * Minor performance improvement using reverse instead of toReversed * Link to a new issue with a more complete description * Refactor hack into its own funtion
* Add defaultFontSizes option for theme.json * Fix defaultFontSizes causing errors when missing * Simplify useMergedSettings * Simplify more * Remove the memo because it's probably fine * Try ignoring how overrides are handled in the dropdown * Minor performance improvement using reverse instead of toReversed * Link to a new issue with a more complete description * Refactor hack into its own funtion
* Add defaultFontSizes option for theme.json * Fix defaultFontSizes causing errors when missing * Simplify useMergedSettings * Simplify more * Remove the memo because it's probably fine * Try ignoring how overrides are handled in the dropdown * Minor performance improvement using reverse instead of toReversed * Link to a new issue with a more complete description * Refactor hack into its own funtion
* Add defaultFontSizes option for theme.json * Fix defaultFontSizes causing errors when missing * Simplify useMergedSettings * Simplify more * Remove the memo because it's probably fine * Try ignoring how overrides are handled in the dropdown * Minor performance improvement using reverse instead of toReversed * Link to a new issue with a more complete description * Refactor hack into its own funtion
Removing the labels as this has been reverted. |
What?
Adds a
defaultFontSizes
option to disable showing the default font sizes.When
defaultFontSizes === false
the options are removed from the UI.By default
defaultFontSizes
istrue
.Why?
Resolves #52200
How?
TypographyPanel
to remove defaults when the option was set to falseTesting Instructions
Test the new
defaultFontSizes
.settings.typography.defaultFontSizes = false
to your theme.json file.Test that duplicate font sizes are removed.
settings.typography.fontSizes
to include duplicate slugs.Testing Instructions for Keyboard
N/A
Screenshots or screencast
Tested with the theme.json from the example in #52200 and
defaultFontSizes
set tofalse
.