fix(SegmentedRadioGroup): ignore non-option siblings#2685
Open
Su9DenLY wants to merge 2 commits into
Open
Conversation
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts SegmentedRadioGroup option styling selectors so that visual grouping and borders apply only to actual option siblings, correctly ignoring any non-option siblings, and refines the checked-state overlap behavior. File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The new selectors using :has and sibling combinators are quite dense; consider adding comments or simplifying them (e.g., extracting shared selector pieces into variables/mixins) to make the intent and grouping behavior easier to understand and maintain.
- Since :has is still not universally supported in all environments, verify that this component’s supported browser matrix is aligned with :has usage or provide a graceful fallback for environments without :has.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new selectors using :has and sibling combinators are quite dense; consider adding comments or simplifying them (e.g., extracting shared selector pieces into variables/mixins) to make the intent and grouping behavior easier to understand and maintain.
- Since :has is still not universally supported in all environments, verify that this component’s supported browser matrix is aligned with :has usage or provide a graceful fallback for environments without :has.
## Individual Comments
### Comment 1
<location path="src/components/SegmentedRadioGroup/SegmentedRadioGroup.scss" line_range="147-150" />
<code_context>
}
}
+ &_checked ~ & {
+ &:not(&_checked ~ #{$block}__option ~ #{$block}__option)::before {
+ background-color: transparent;
+ }
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Complex nested selector with & inside :not() is brittle and risks subtle bugs when multiple options are checked or markup changes.
This selector chain is difficult to reason about, particularly the `&` inside `:not()`, which makes it hard to confirm it only affects options after the checked one and behaves correctly when multiple `_checked` options can briefly coexist. Please simplify this by splitting it into clearer selectors or using explicit state/modifier classes to express the relationship between checked and non-checked options, even if it requires a bit more markup or JS.
```suggestion
// For all options that come after a checked option, reset the background
&_checked {
& ~ & {
&::before {
background-color: transparent;
}
}
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Contributor
|
Preview is ready. |
Contributor
|
🎭 Component Tests Report is ready. |
2 tasks
Contributor
|
@Su9DenLY Let's hold with this fix, maybe it's not needed at all. Waiting for the user's answer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by Sourcery
Adjust segmented radio group styling to only treat actual option elements as segmented siblings, preventing layout artifacts when other elements are present.
Bug Fixes: