Skip to content
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

Revert shadow.defaultPresets default to true #60000

Closed

Conversation

ajlende
Copy link
Contributor

@ajlende ajlende commented Mar 19, 2024

Trac ticket: https://core.trac.wordpress.org/ticket/60815
WP Dev PR: WordPress/wordpress-develop#6295

What?

Reverts the core settings.shadow.defaultPresets back to true.

Why?

Fixes #59989

Themes should not change appearance with just a WP update. We have a migration mechanism for theme.json to allow for theme authors to change default values that should be used if we want to change a default.

All of the default* settings have been true by default as they've been added, so this brings consistency to that again as well.

How?

  • Changes the settings.shadow.defaultPresets to true in lib/theme.json.
  • Removes array( 'shadow', 'defaultPresets' ) from APPEARANCE_TOOLS_OPT_INS as it is no longer needed when we have true by default.
  • Adds editor-shadow-presets and default-shadow-presets theme supports for classic themes to match how colors/gradients presets work.
  • Updates related docs/tests.

Testing Instructions

Block themes

Here is an example theme.json for testing that would override the default natural shadow with a red shadow to make the difference obvious.

// theme.json
{
	"$schema": "https://schemas.wp.org/wp/6.4/theme.json",
	"version": 2,
	"settings": {
		"shadow": {
			"presets": [
				{
					"name": "Natural",
					"slug": "natural",
					"shadow": "6px 6px 9px #F00"
				}
			]
		},
		"layout": {
			"contentSize": "840px",
			"wideSize": "1100px"
		}
	},
	"styles": {
		"blocks": {
			"core/button": {
				"shadow": "var(--wp--preset--shadow--natural)"
			}
		}
	}
}
  1. Use the above theme.json as an example theme.
  2. Insert a button in a post.
  3. Preview the post in wp/6.4
  4. Preview the post in trunk
  5. Preview the post in this PR
  6. See that wp/6.4 and this PR match.

Classic themes

TODO: Finish writing testing scenarios.

  • Test disabling shadow presets.

    add_theme_support( 'editor-shadow-presets', array() );
  • Test custom shadow presets.

    add_theme_support( 'editor-shadow-presets', array(
      array(
        "name"   => "Custom Shadow",
        "slug"   => "custom-shadow",
        "shadow" => "10px 10px 0px 0px #F0F"
      )
    ) );
  • Test disabling default shadow presets.

    add_theme_support( 'default-shadow-presets', false );

Testing Instructions for Keyboard

N/A

Screenshots or screencast

Block themes

WP 6.4

Screen Shot 2024-03-19 at 12 56 11

Current 6.5 ("defaultPresets": false)

Screen Shot 2024-03-19 at 12 55 36

This PR ("defaultPresets": true)

Screen Shot 2024-03-19 at 12 55 24

Classic themes

TODO: Screenshots of UI for classic themes in each of the testing scenarios.

@ajlende ajlende added [Type] Regression Related to a regression in the latest release Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels Mar 19, 2024
Copy link

github-actions bot commented Mar 19, 2024

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ajlende <ajlende@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: andrewserong <andrewserong@git.wordpress.org>
Co-authored-by: getdave <get_dave@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@ajlende
Copy link
Contributor Author

ajlende commented Mar 27, 2024

Closing in favor of #60204

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Regression Related to a regression in the latest release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Backwards compatibility issue with shadow defaultPresets
2 participants