Skip to content

Global Styles: Make Button element inherit all typography styles on the frontend #70676

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

Merged
merged 2 commits into from
Jul 16, 2025

Conversation

shrivastavanolo
Copy link
Contributor

@shrivastavanolo shrivastavanolo commented Jul 10, 2025

What?

Closes #60403

Button elements in WordPress Gutenberg are missing inherited typography styles, including font-style, text-transform, letter-spacing, and font-weight, which are applied in the editor but not on the frontend.

Why?

The issue needs to be fixed because button elements in WordPress Gutenberg are missing some inherited typography styles, including font-style, text-transform, letter-spacing, and font-weight, which are applied in the editor but not on the frontend.

How?

This change is related to an issue where button elements with the wp-element-button class were not inheriting certain typography styles, such as font style, text transform, letter spacing, and font weight, when updated via the Global Styles. The issue was observed when updating typography styles at the root level, then inserting a Search block. The expected behavior is for these styles to be applied to the button element on the frontend, but currently, they are not. The provided code change aims to address this issue by adding the missing styles to the typography object.

Testing Instructions

  • Go to the Site Editor > Global Styles > Typography > Text > Typography panel
  • Update all styles.
  • Insert a Search block in a post and check if it's style is getting inherited on the front end.

Screenshots or screencast

Before

Screenshot 2025-07-10 at 3 11 07 PM

After

Screenshot 2025-07-10 at 3 11 20 PM

note: please let me know if this needs to be backported to core, I'll be happy to create a corresponding core ticket for it.

@shrivastavanolo shrivastavanolo marked this pull request as ready for review July 10, 2025 10:54
Copy link

github-actions bot commented Jul 10, 2025

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

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

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: .

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.

@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels Jul 11, 2025
@t-hamano
Copy link
Contributor

@shrivastavanolo Thanks for the PR!

This PR makes sense to me, but this improvement requires a bit more work to get right in both core and Gutenberg. The reason is that this default theme.json file works correctly when the plugin is enabled, but doesn't work when the plugin is disabled. We need to submit a core ticket and a patch so that we can ship this enhancement in the next core release.

First, check the following documentation: https://github.com/WordPress/gutenberg/blob/795734c9741904eb00243bae1f3d787512052e03/backport-changelog/readme.md

Have you ever submitted a ticket or patch to core?

@shrivastavanolo
Copy link
Contributor Author

Hey, @t-hamano

Have you ever submitted a ticket or patch to core?

Yeah, I have submitted some PRs to wordpress-develop before. I have gone through the documentation you shared and will start by creating a Trac ticket for this and then adding the core PR to the changelog. Thanks for the feedback!

@t-hamano
Copy link
Contributor

Thank you, @shrivastavanolo! Just to be sure, I'll tell you the tasks we need to do.

  • Submit a core ticket with the same content as a. It would be a good idea to link #60403 to that core ticket.
  • Submit a patch to that core ticket.
  • In this PR, create a backport-changelog/6.9/{core-pr-number}.md file.

@shrivastavanolo shrivastavanolo force-pushed the fix/global-style-for-button branch from 8de8bd6 to 75d602e Compare July 15, 2025 11:14
@shrivastavanolo
Copy link
Contributor Author

Hey @t-hamano,
I've completed all the mentioned tasks: submitted the core ticket + patch, and added the backport changelog file in this PR. Let me know if anything else is needed. Thanks!

Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

LGTM! Everything seems to be working as expected.

Testing Instructions

  • Go to the Site Editor > Global Styles > Typography > Text > Typography panel
  • Update all typography styles (Font, Font Size, Appearance, Line height, Letter Spacing, Letter Case)
  • Create a post.
  • To test both the search block and the button element, insert the following HTML via the code editor:
    <!-- wp:search {"label":"Search","placeholder":"Placeholder","buttonText":"Push Me"} /-->
    <!-- wp:html -->
    <button class="wp-element-button">Push Me</button>
    <!-- /wp:html -->

Screenshots

Before

Some typography styles are not being applied to the buttons:

image

After

All typography styles are applied to both the Search block and the button element:

image

@t-hamano t-hamano merged commit 7e5dfbb into WordPress:trunk Jul 16, 2025
60 checks passed
@github-actions github-actions bot added this to the Gutenberg 21.3 milestone Jul 16, 2025
USERSATOSHI pushed a commit to USERSATOSHI/gutenberg that referenced this pull request Jul 23, 2025
…he frontend (WordPress#70676)

* style: update theme.json to inherit button styles on frontend

* docs: update backport changelog

Co-authored-by: shrivastavanolo <shreya0shrivastava@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: annezazu <annezazu@git.wordpress.org>
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] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Global Styles: Button element should inherit all typography styles on the frontend
2 participants