-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Fix: Update styles for checkbox and radio controls. #61696
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. |
Hi @jameskoster, |
@vipul0425 thanks! How did you feel about increasing the spacing between radios to 12px? |
Hi @jameskoster, Sorry for replying that late. I have revised the spacing between radio controls to |
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.
I had some tweaks and questions, but on the whole this is looking good 👍
{ __( | ||
'Visitors cannot add new comments or replies. Existing comments remain visible.' | ||
) } |
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.
Was this committed by accident?
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.
No, Actually when we updated the spacing between the spacing between the input and label to 12px
then it was not looking visually appealing so converted it to a single line. But I think now its not required as we have revised it to 8px. Will update this in next commit.
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.
Wait, is the extra wrapper remaining intentional?
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.
Oh sorry @mirka it was a mistake 😓 Will update this.
@@ -55,7 +57,7 @@ | |||
.components-checkbox-control__input-container { | |||
position: relative; | |||
display: inline-block; | |||
margin-right: $grid-unit-15; | |||
margin-right: var(--checkbox-input-margin); |
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 change wasn't reflected in the help text margin, so I extracted it into a CSS var (f050242).
} | ||
|
||
p.components-base-control__help:has(.components-checkbox-control__help) { | ||
margin-top: $grid-unit-05; |
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.
Was this change discussed somewhere? The margin-top is still the standard 8px on the RadioControl, so not sure where this came from. I would prefer not to override this BaseControl style if possible, since it's a standard value across many components.
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.
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.
I see. That small text under those radio controls are custom spans injected by the consumer, and not the help
text of the RadioControl
component. The help
text of the RadioControl is just a single chunk of text underneath all the options of a radio group.
![Help text under RadioControl](https://private-user-images.githubusercontent.com/555336/336586750-8cbf24f6-1da1-476e-bf0b-0fd64de7709c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIxMjQ3NzQsIm5iZiI6MTcyMjEyNDQ3NCwicGF0aCI6Ii81NTUzMzYvMzM2NTg2NzUwLThjYmYyNGY2LTFkYTEtNDc2ZS1iZjBiLTBmZDY0ZGU3NzA5Yy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzI3JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcyN1QyMzU0MzRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01YmFiNWUwNmFjMTk5NTk5YTFkNTI4ZDJhNDM3NWZmZjA2YTFiODZlNzk4Njg0NDkyNzMzNmZmZWVmNzMwOTNmJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.hde25OgZozrwHsTZl_-fHRE5w61cKb2jnwlHki8SANo)
The point is, we shouldn't be basing this decision (help
text margin of the CheckboxControl) on a non-standard RadioControl use case like that "Status & visibility" panel.
For the scope of this PR, I would recommend removing this override of the CheckboxControl help
text margin.
(No strong opinion about what kind of consistency improvements you might want to make at the consumer level in the "Status & visibility" panel itself.)
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.
@mirka I agree thanks 🙇 . I have removed that style from the base component and added it specifically for the "status and visibility" panel I think it makes more sense there as radio and checkbox are similar so the spacing between the help text in both of these should look consistent in that panel. Is it good to go or we need to make any other changes here?
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.
Looks good, thank you for all the follow-ups! Please add a changelog for the style changes in CheckboxControl and RadioControl, and we're good to merge 👍
@mirka Updated the changelog and rebased the branch 🙇 . |
Is the a bug for or enhancement. Title and label don't match. Should this fix be included in 6.6 Beta? |
Yes @ellatrix It was for enhancement in the checkbox and radio controls. It can be included in 6.6 Beta. |
* Fix: Update styles for checkbox and radio controls. * chore: Update margin-right for checkbox and radio controls in style.scss * fix: the sapcing b/w radio controls to 8px. * refactor: Revised the spacing b/w radio-controls to '12px'. * Fix checkbox help margin * Revert the line break change in post-comments. * fix: The changes as per feedback. * Doc: Updates the changelog.md. * Fixup changelog --------- Co-authored-by: vipul0425 <vipulgupta003@git.wordpress.org> Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: jameskoster <jameskoster@git.wordpress.org>
What?
Fixes issue: #61652
Why?
The current spacing between the checkbox input and its label is inconsistent with that of the radio buttons, even though they have the same size.
How?
This PR updates the stylings for the checkbox control and radio control to make them consistent.
Testing Instructions
Testing Instructions for Keyboard
nil
Screenshots or screencast