-
Notifications
You must be signed in to change notification settings - Fork 129
fix(Checkbox, Radio, Switch): fix text alignment #2342
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
base: main
Are you sure you want to change the base?
Conversation
Reviewer's GuideThis PR refactors the styling of Checkbox, Radio, Switch, and ControlLabel components by streamlining indicator CSS, consolidating control positioning with the inset shorthand, adding focus outline offsets, and adjusting label alignment to correct text placement. Class diagram for updated component structure and stylingclassDiagram
class Checkbox {
+__indicator: position: relative
+__control: position: absolute; inset: 0; opacity: 0
+__control:focus-visible + __outline: outline-offset: 1px
}
class Radio {
+__indicator: position: relative
+__control: position: absolute; inset: 0; opacity: 0
+__control:focus-visible + __outline: outline-offset: 1px
+__disc: inset by size, background-color on checked
}
class Switch {
+__indicator: position: relative
+__control: position: absolute; inset: 0; opacity: 0
+__control:focus-visible + __outline: outline-offset: 1px
}
class ControlLabel {
+display: inline-flex
+align-items: baseline
+__indicator: display: flex; align-items: center; justify-content: center
+__indicator::after: content: '\00a0'; visibility: hidden
}
Checkbox --|> ControlLabel : label wraps indicator
Radio --|> ControlLabel : label wraps indicator
Switch --|> ControlLabel : label wraps indicator
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @amje - I've reviewed your changes - here's some feedback:
- Consider extracting the repeated focus-visible outline and outline-offset logic into a shared mixin to keep the focus styles DRY across Checkbox, Radio, and Switch.
- Since you've removed explicit cursor: pointer on the __control elements, double-check that the parent container still provides the expected pointer cursor for clickable inputs.
- After switching ControlLabel to align-items: baseline, please verify multi-line labels or icons still align correctly and no vertical misalignment is introduced.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider extracting the repeated focus-visible outline and outline-offset logic into a shared mixin to keep the focus styles DRY across Checkbox, Radio, and Switch.
- Since you've removed explicit cursor: pointer on the __control elements, double-check that the parent container still provides the expected pointer cursor for clickable inputs.
- After switching ControlLabel to align-items: baseline, please verify multi-line labels or icons still align correctly and no vertical misalignment is introduced.
## Individual Comments
### Comment 1
<location> `src/components/Switch/Switch.scss:9` </location>
<code_context>
&__control {
position: absolute;
- inset-block-start: 0;
- inset-inline-start: 0;
</code_context>
<issue_to_address>
Setting 'cursor: inherit' on __control may not provide the expected pointer cursor for interactive elements.
If the parent doesn't set a pointer cursor, users may not see the expected pointer on hover. Please confirm this matches your intended user experience.
</issue_to_address>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
position: absolute; | ||
inset: 0; | ||
margin: 0; | ||
padding: 0; | ||
opacity: 0; | ||
cursor: pointer; | ||
background: none; | ||
border: none; | ||
outline: none; | ||
cursor: inherit; |
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.
issue: Setting 'cursor: inherit' on __control may not provide the expected pointer cursor for interactive elements.
If the parent doesn't set a pointer cursor, users may not see the expected pointer on hover. Please confirm this matches your intended user experience.
Preview is ready. |
Visual Tests Report is ready. |
Summary by Sourcery
Fix text alignment issues in Checkbox, Radio, Switch, and ControlLabel components by refining CSS styles and layout rules.
Bug Fixes:
Enhancements: