-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Global Styles: Make Button element inherit all typography styles on the frontend #70676
Conversation
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
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. |
@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? |
Hey, @t-hamano
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! |
Thank you, @shrivastavanolo! Just to be sure, I'll tell you the tasks we need to do.
|
8de8bd6
to
75d602e
Compare
Hey @t-hamano, |
There was a problem hiding this 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:
After
All typography styles are applied to both the Search block and the button element:
…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>
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
Screenshots or screencast
Before
After
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.