-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Buttons: Add typography supports to button/s blocks #43934
Buttons: Add typography supports to button/s blocks #43934
Conversation
Size Change: +540 B (0%) Total Size: 1.25 MB
ℹ️ View Unchanged
|
A font size added in the global styles doesn't override the default font size added to the button link, eg. in the following font size x-large is added in global styles, but doesn't show in the top button, but the second one has x-large set at the Buttons block level in post editor and it does work as the use of this could be a tricky one to resolve, but will have a play around with it. |
Thanks for testing this one @glendaviesnz 👍
Can you confirm if you were adding the font size to the |
That was with |
Thanks for clarifying. I did encounter that while testing this myself. It's what lead to the note in the PR description.
Given you can get that global styling for buttons via the |
Sorry, I misread that description note, I agree that no need to make this a blocker. |
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.
✅ Could add typography supports in post editor tools panel and changes were reflected in editor and frontend for Button and Buttons
✅ Could set typography supports in global styles and change reflected in site editor, post editor and frontend, with exception of the noted issues of Button styles overriding some global Buttons styles
✅ Could set typography supports in theme.json and both reflected in editor and frontend
Too many uses of |
@@ -75,3 +75,7 @@ | |||
div[data-type="core/button"] { | |||
display: table; | |||
} | |||
|
|||
.editor-styles-wrapper .wp-block-button[style*="text-decoration"] .wp-block-button__link { |
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.
Why was .editor-styles-wrapper
needed here? What breaks if it's removed?
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.
At the time of this PR, I believe it was required for custom typography settings to be applied properly when set on a block instance. From memory, that might have been related to Global Styles getting scoped to under that editor styles wrapper class.
If we want to clean this up, we'd just need to re-test following the PR test instructions. If the button styles all behave we should be safe to remove these editor styles.
I've run out of time today but a quick test shows it should be ok to remove the editor styles. I might have also found a secondary minor issue with text transform styles.
A draft PR is up in #56630 but I'll need to give it a more thorough test before it is ready.
Thanks for flagging this @ellatrix 👍
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.
This might help to avoid it for the non iframed editor: #56649
Related:
What?
Buttons
blockButton
blockNote: This PR is very similar to #43649 & #41435 but combines the changes for both blocks to facilitate easier testing and ensuring the two "opt-ins" play nice together.
Why?
Buttons
block allows styles to be set once for for all buttons in a given groupHow?
Buttons
blockButton
blockButtons
block if a font size is selected. This allows such blocks to apply styles to the inner button link to inherit font size.Button
orButtons
block has text-decoration applied and style the inner button links to inherit that style.Testing Instructions
Buttons
block to a post and select itButton
block and repeat the same process as with its parent block.Buttons
block in both the editor and front end.Button
blocks continues to work.Buttons
block via theme.json together with styles for theButton
block and ensure that theButton
block styles take precedence.Example: Theme.json snippet. (
Note: Given the
Button
block's styles these might override theme.json/global styles generated for theButtons
block (e.g. text-decoration). I think this is ok for now and shouldn't block this PR given stylingButton
blocks globally is essentially the same as styling aButtons
block and having that apply to the innerButton
blocks. AButton
block can only be added within aButtons
block anyway.Screenshots or screencast
Screen.Recording.2022-09-07.at.3.57.59.pm.mp4