Skip to content

Global Styles: reduce state control toggle button size - #80115

Closed
t-hamano wants to merge 5 commits into
trunkfrom
fix/state-control-button-size
Closed

t-hamano wants to merge 5 commits into
trunkfrom
fix/state-control-button-size

Conversation

@t-hamano

@t-hamano t-hamano commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

What?

Reduce the size of the icon-only toggle button in the Global Styles StateControl component from compact to small.

Why?

To match the size of the dropdown toggle buttons used in other tools panels. The text button (with chevron) is unaffected.

How?

Change size: 'compact' to size: 'small' only for the icon-only toggle. The text variant keeps compact.

Testing Instructions

  1. Insert a Button block and open the block inspector.
  2. Confirm its size now matches the dropdown toggle buttons in other tools panels.

Screenshots or screencast

Before After
image image

Use of AI Tools

Claude Code (Opus) was used to make the change and draft this PR. All changes were reviewed by the author.

Change the icon-only toggle from the "compact" size to the smaller
"small" size in the StateControl component.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added the [Package] Block editor /packages/block-editor label Jul 10, 2026
Limit the top-margin heading-alignment adjustment to the text variant
(`.has-text`), since the smaller icon-only toggle no longer needs it.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

Size Change: +59 B (0%)

Total Size: 7.91 MB

📦 View Changed
Filename Size Change
build/scripts/block-editor/index.min.js 475 kB +10 B (0%)
build/styles/block-editor/style-rtl.css 20.2 kB +14 B (+0.07%)
build/styles/block-editor/style-rtl.min.css 17.2 kB +12 B (+0.07%)
build/styles/block-editor/style.css 20.3 kB +12 B (+0.06%)
build/styles/block-editor/style.min.css 17.2 kB +11 B (+0.06%)

compressed-size-action

Add a dedicated `show-text` class to the toggle when text is shown and
target it in CSS, instead of relying on the components package's
internal `has-text` class.

Co-Authored-By: Claude <noreply@anthropic.com>
}

.block-editor-global-styles-state-control {
.block-editor-global-styles-state-control:has(.show-text) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The negative margin is only necessary for buttons with text that are 32px in size. We are relying on our own class because I did not want to depend on the has-text class, which is an internal class of the Button component.

@t-hamano t-hamano added [Type] Enhancement A suggestion for improvement. [Feature] Style States Related to block style states (currently viewport and pseudo-states) labels Jul 10, 2026
@t-hamano t-hamano self-assigned this Jul 10, 2026
@t-hamano
t-hamano marked this pull request as ready for review July 10, 2026 15:16
@t-hamano
t-hamano requested a review from ellatrix as a code owner July 10, 2026 15:16
@github-actions

github-actions Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

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: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: talldan <talldanwp@git.wordpress.org>

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

@github-actions

github-actions Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

Flaky tests detected in 2459c69.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/32839061750
📝 Reported tests:

can add a page link to an empty link field in /test/e2e/specs/editor/blocks/navigation.spec.js, passed after 1 failed attempt.
Error: apiRequestContext.fetch: socket hang up
Call log:
  - → DELETE http://localhost:8889/wp-json/wp/v2/pages/141?force=true
    - user-agent: Playwright/1.62.1 (x64; ubuntu 24.04) node/20.20 CI/1
    - accept: */*
    - accept-encoding: gzip,deflate,br
    - X-WP-Nonce: 8afa83db5c
    - cookie: wordpress_test_cookie=WP%20Cookie%20check; wordpress_logged_in_23778236db82f19306f247e20a353a99=admin%7C1787828261%7CZdLAomTK7B2NW7HT18V5DG7XigK8tTfYfFH4R03VP9c%7C160aaf51a2c6caacdcc2845317ed93311ced111f0979382dff294405318bab80; wp-settings-time-1=1787655461

    at RequestUtils.rest (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/rest.ts:112:39)
    at RequestUtils.call (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/pages.ts:27:20)
    at map (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/pages.ts:56:37)
    at RequestUtils.deleteAllPages (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/pages.ts:56:9)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/navigation.spec.js:1936:4

t-hamano and others added 2 commits July 11, 2026 11:37
…tton-size

# Conflicts:
#	packages/block-editor/src/components/global-styles/state-control.js
@talldan

talldan commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

@t-hamano the PR title and description doesn't seem to match what the code does. The screenshots show block instances not global styles. The code doesn't change the size of the icon style button to small, it stays 'compact' (I believe that was already done in #80505).

@t-hamano

Copy link
Copy Markdown
Contributor Author

Oh, this issue is already addressed in #80505. I think this PR can be closed now.

@t-hamano t-hamano closed this Aug 27, 2026
@t-hamano
t-hamano deleted the fix/state-control-button-size branch August 28, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Style States Related to block style states (currently viewport and pseudo-states) [Package] Block editor /packages/block-editor [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants