Skip to content

Global Styles: Respect global border radius opt-out for button block #70984

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

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

BugReportOnWeb
Copy link
Contributor

What?

Closes #56626

This PR ensures that core/button block default settings of border.radius do not override a theme's explicit intent when global support for border is disabled.

Why?

Currently, if a theme sets settings.border.radius to false, the core/button block still shows the border radius UI because core provides a default of true for that block. This leads to confusing behavior where the global opt-out isn't fully respected unless the theme also disables the block level setting manually.

How?

  • Introduces a helper function resolve_core_block_default_conflicts() called in get_merged_data()
  • This helper checks:
    • If the global border radius is explicitly disabled by the theme.
    • If the block level core/button setting comes only from core (not overridden by theme).
    • If both are true, the core provided core/button.border.radius is unset.

Testing Instructions

  1. Use a theme with the following theme.json:
{
	"version": 2,
	"settings": {
		"border": {
			"color": false,
			"radius": false,
			"style": false,
			"width": false
		}
	}
}
  1. Open the site editor or post editor and select a button block.
  2. Confirm that the Border Radius control does not appear in the block settings panel.

Screenshots or screencast

Using the above provided config for theme.json

Before After
Screenshot 2025-07-30 at 7 23 05 PM Screenshot 2025-07-30 at 7 22 48 PM

@t-hamano
Copy link
Contributor

Thanks for the PR! Let's have more discussion before moving forward with this PR. See #56626 (comment)

@t-hamano t-hamano added [Block] Buttons Affects the Buttons Block Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels Jul 31, 2025
Copy link

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Type-related labels to choose from: [Type] Automated Testing, [Type] Breaking Change, [Type] Bug, [Type] Build Tooling, [Type] Code Quality, [Type] Copy, [Type] Developer Documentation, [Type] Enhancement, [Type] Experimental, [Type] Feature, [Type] New API, [Type] Task, [Type] Technical Prototype, [Type] Performance, [Type] Project Management, [Type] Regression, [Type] Security, [Type] WP Core Ticket, Backport from WordPress Core, Gutenberg Plugin.
  • Labels found: [Block] Buttons, Global Styles.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

1 similar comment
Copy link

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Type-related labels to choose from: [Type] Automated Testing, [Type] Breaking Change, [Type] Bug, [Type] Build Tooling, [Type] Code Quality, [Type] Copy, [Type] Developer Documentation, [Type] Enhancement, [Type] Experimental, [Type] Feature, [Type] New API, [Type] Task, [Type] Technical Prototype, [Type] Performance, [Type] Project Management, [Type] Regression, [Type] Security, [Type] WP Core Ticket, Backport from WordPress Core, Gutenberg Plugin.
  • Labels found: [Block] Buttons, Global Styles.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Button block overrides global theme.json settings for border radius
2 participants