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

Allow disabling the shadow panel #48753

Closed
carolinan opened this issue Mar 4, 2023 · 12 comments
Closed

Allow disabling the shadow panel #48753

carolinan opened this issue Mar 4, 2023 · 12 comments
Labels
[Block] Buttons Affects the Buttons Block Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended

Comments

@carolinan
Copy link
Contributor

Description

There is no way to turn off the Shadow panel in Site Editor > Styles > Blocks > Button
If theme.json turns off all presets, the panel still shows, but it has no options.

Step-by-step reproduction instructions

Add the following under settings in theme.json:

	"shadow": {
		"presets": [],
		"defaultPresets": false
	},

Screenshots, screen recording, code snippet

The panel shows but there are no options:
Shadow panel and modal in the Styles Sidebar

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@carolinan carolinan added the Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json label Mar 4, 2023
@tomdevisser
Copy link
Member

Where did you find the "defaultPresets": false option? It doesn't show up in my theme schema yet, or are you suggesting we add this?

@tomdevisser
Copy link
Member

One other question, I can't find a disable option for the other options, like border. Should that be added as well? Why only for the shadow? Or am I missing something? :)

@carolinan
Copy link
Contributor Author

From the shadow PR #46502 and theme.json https://github.com/WordPress/gutenberg/blob/trunk/lib/theme.json#L190

Shadow is enabled by default. Border is opt-in, disabled by default.

@carolinan
Copy link
Contributor Author

It follows the same pattern as other settings: "defaultPalette": false, "defaultGradients": false. "defaultDuotone": false

@colorful-tones
Copy link
Member

I went as far as trying the above and this and the empty shadow panel still shows (as reported by Carolina).

{
    "settings": {
        "blocks": {
            "core/button": {
                "shadow": false
            }
        }
    }
}

@jordesign jordesign added [Type] Bug An existing feature does not function as intended [Block] Buttons Affects the Buttons Block labels Jul 27, 2023
@cbirdsong
Copy link

cbirdsong commented May 14, 2024

This is not specific to the button block. It also shows up on column blocks.

@carolinan
Copy link
Contributor Author

Yes this issue is a bit out of date since the shadow controls changed in WP 6.5.

@t-hamano
Copy link
Contributor

t-hamano commented Jun 1, 2024

This issue could not be reproduced in the latest Gutenberg. It seems that we just need to set settings.shadow.defaultPresets to false:

{
	"$schema": "../../schemas/json/theme.json",
	"version": 3,
	"settings": {
		"appearanceTools": true,
		"layout": {
			"contentSize": "840px",
			"wideSize": "1100px"
		},
		"shadow": {
			"defaultPresets": false
		}
	}
}

I would like to close this issue, but please feel free to reopen it at any time if the problem reoccurs.

@t-hamano t-hamano closed this as not planned Won't fix, can't repro, duplicate, stale Jun 1, 2024
@carolinan
Copy link
Contributor Author

I still don't think this is the correct solution since the name of the option is to literally set the default presets to false, not disable the option. 🤷‍♀️

@t-hamano
Copy link
Contributor

t-hamano commented Jun 1, 2024

I believe what is considered a bug in this issue is that the panel is unintentionally displayed even though there is no preset. This issue has already been resolved.

Furthermore, I believe that the specification that the panel's visibility depends on whether there is a preset is consistent across colors, font sizes, and shadows.

What is the correct solution required here?

@carolinan
Copy link
Contributor Author

carolinan commented Jun 1, 2024

Colors has text, background, link heading etc that is a boolean set to true or false, which are separate from disabling presets.
So does sticky, aspectratio, background image etc.
The different logic used for similar settings makes theme.json more difficult to use because there is no one pattern to follow.

@t-hamano
Copy link
Contributor

t-hamano commented Jun 1, 2024

I see, so you want to be able to set a boolean instead of an array, as mentioned in the comment? Either way, that would be considered an enhancement, and it's not just limited to shadow presets, so it might be best to open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Buttons Affects the Buttons Block Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

6 participants