-
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
Disable core shadow presets by default, let themes opt-in #58766
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
3598a52
disable core presets by default, let themes opt-in
madhusudhand c89f8af
add shadow/defaultPresets to appearance tools optins
madhusudhand 8aa28a7
update unit tests related to appearance tools
madhusudhand 2d2b5d2
Update packages/block-editor/src/components/global-styles/shadow-pane…
madhusudhand File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
@madhusudhand This is a breaking change for themes that have shadow presets with the same slug as the core presets as it changes the CSS output for the theme. It should have a theme.json version bump and migration to maintain backwards compatibility.
I've been discussing this in #58409 (comment) since I want to change the default for the font sizes presets as well.
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.
This change updates
defaultPresets
from true to false, and also it is controlled by appearanceTools setting.Meaning that defaultPresets are off by default and when
appearanceTools
is set to true, they are enabled, which makes existing themes that are using default presets to work as before.Also, I created #59893 to discuss on this idea of theme being able to add(override) a preset with same slug as core preset.
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.
appearanceTools
is alsofalse
by default, so it's still a problem for themes that haven't configured either.Before this change, with a theme that has custom
settings.shadow.presets
defined with matching slugs to those in the defailt lib/theme.json andsettings.shadow.defaultPresets
andsettings.appearanceTools
both undefined, you'll end up with different CSS that gets output to the page.In the first case the default styles will be output and in the second case, the theme styles will be output.
Here's an example of what I'm talking about.
It's because to the
settings.shadow.defaultPresets
being used as the value forprevent_override
inPRESETS_METADATA
inWP_Theme_JSON
. The setting defines the behavior of matching slugs in the default and theme origins for presets in theme.json.gutenberg/lib/class-wp-theme-json-gutenberg.php
Line 181 in cdfd751
gutenberg/lib/class-wp-theme-json-gutenberg.php
Lines 2868 to 2876 in cdfd751
I'm suggesting that we revert this for 6.5 (at least this line since it is the one causing the problems). Then we can use the theme.json version bump to opt-in to breaking changes like this.
I'm adding the theme.json version bump in #58409. So you'd just need to update the migration from that PR to make sure that existing themes are unaffected.
Hopefully that all makes sense. 😅
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.
Thank for details @ajlende.
I see that it may break a shadow when the following conditions are met
appearanceTools: false
Also, prior to 6.5 shadows are enabled for
button
block and in global styles only.It seems to be very unlikely edge case and shouldn't have big impact on themes.
@annezazu @swissspidy @t-hamano what do you think?
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.
Also cc @fabiankaegy editor triage co-lead.
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.
I decided it was best to create a dedicated issue where this can be discussed.
#59989
This is also useful as it can be placed in
Triage
on the WP 6.5 Editor board for review by Editor triage leads.