-
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
BaseControl: change label's display: block #63911
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. |
Size Change: -110 B (-0.01%) Total Size: 1.76 MB
ℹ️ View Unchanged
|
🤔 I'm not sure I know of a way to trim the whitespace associated to Maybe we could change |
Thanks for following up! For what it's worth, this has solved the alignment issue in #63886:
For anyone else following along, the issue described in #9612 can be tested in this PR by using a narrower viewport width with the Typography controls. In this PR, clicking the whitespace to the right of the Appearance label will redirect focus to the component. The earlier fix in #14478 prevented this. However, I notice in Trunk2024-07-25.11.57.13.mp4This PR2024-07-25.11.47.12.mp4In some ways this PR nearly makes things feel a bit more consistent to me, but I don't feel strongly either way about the clickable area problem.
If it's worth it to fix the width of the labels to limit the clickable area, then this sounds worth a try to me! |
As a fix for #63886, this works for me too 👍
Given that it appears #9612 wasn't fully solved and we have some inconsistency there on trunk, I'd lean toward fixing the obvious visual alignment and follow up on the trimming of whitespace separately.
This might be the best bet long term to get the best of both worlds. |
Good point 💯 |
I agree with this 👍 Also, confirming that this tests well across various controls in the post and site editor and resolves #63886. |
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.
Realized I didn't formally approve the PR, so here goes ✅
Thank you, folks! If the size of the clickable label ever becomes problematic, we can test the suggested approach above:
|
Thanks for landing this fix, @ciampo! 🙇 |
What?
Change the label style of
BaseControl
fromdisplay: inline-block
todisplay: block
Why?
Using
display: inline-block
wouldn't trim the white space around the label, which would cause inconsistent gaps across the editor based on the layout inherited from the parent element rendering the label.Switching to
display: block
ensures that the white space is always trimmed consistently.How?
display: inline-block
todisplay: block
Testing Instructions
The label is publicly exposed via the
BaseControl.VisualLabel
component, and internally via theStyledLabel
styled component.Affected components:
BorderControl
,BorderBoxControl
,FormTokenField
,CustomSelectControl
,TimeInput
,TimePicker
,DateTimePicker
,FontSizePicker
,ToggleGroupControl
.I honestly think that there shouldn't be regressions, but I recommend folks to do some smoke testing across Storybook and the editor. I don't think we need extensive testing either — if any layout breaks we will likely find out as we go in the upcoming weeks; it shouldn't compromise the usability of the product and it will be an easy fix.
Also, make sure that #63886 is fixed.