Allow SegmentedControl labels to wrap without overflow - #8442
joshfarrant wants to merge 12 commits into
Conversation
🦋 Changeset detectedLatest commit: d7bfaa1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The enlarged-text test can pass despite horizontal overflow because it samples page overflow too early and only checks content height.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Updates SegmentedControl to grow vertically for wrapped labels while preserving standard minimum heights.
Changes:
- Replaces fixed heights with minimum heights.
- Adds multiline Storybook and Playwright coverage.
- Adds an
@primer/reactpatch changeset.
| File | Description |
|---|---|
SegmentedControl.module.css |
Allows vertical growth. |
SegmentedControl.features.stories.tsx |
Adds wrapping scenarios. |
SegmentedControl.features.stories.module.css |
Styles test scenarios. |
SegmentedControl.test.ts |
Adds layout and reflow tests. |
.changeset/segmented-control-wrap-labels.md |
Documents the patch. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Restore existing visual baselines and limit wrapping coverage to natural word boundaries. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
b3d5e7b to
6402b0f
Compare
Keep intrinsic multiline growth without allowing flex parents to stretch single-line controls. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
41565d8 to
0db2543
Compare
Verify computed wrapping styles and accessory labels remain unclipped and unsplit. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Final github-ui integration assessment for github/github-ui#34664 at
This is a real downstream test incompatibility with an unrelated Primer-main FilteredActionList change, not a SegmentedControl regression. The failed run and retry remain linked for follow-up; applying the repository-standard |
|
Integration test results from github/github-ui PR:
CI check runs linting, type checking, and unit tests. Check the workflow logs for specific failures. Need help? If you believe this failure is unrelated to your changes, please reach out to the Primer team for assistance. |
|
Thanks for the review @liuliu-dev! Heads up that I spotted some VRTs were showing some unintended changes so I've pushed a fix for that. No changes to existing VRTs now, the only VRT change is the addition of the new ones. Just flagging for you in case you wanted to take another look before I merge |

Closes github/primer#7156
SegmentedControl previously fixed its track to 32px, or 28px at the small size, which allowed multiline labels to escape the track and selected-state treatment. This PR updates the fixed height to
min-heightso the control grows to its tallest segment.Changelog
New
@primer/reactpatch changeset.Changed
Removed
Rollout strategy
Testing & Reviewing
Primer React tests pass, and compatibility also verified in github-ui.