Skip to content

Conversation

liuliu-dev
Copy link
Contributor

@liuliu-dev liuliu-dev commented Sep 5, 2025

Remove sx from the SegmentedControl component
Closes #5834

sx usage, tracking here: https://github.com/github/primer/issues/5827

Screenshot 2025-09-10 at 9 30 49 AM

Rollout strategy

  • Major release; if selected, include a written rollout or migration plan

Copy link

changeset-bot bot commented Sep 5, 2025

🦋 Changeset detected

Latest commit: 32f40fe

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@primer/react Major
@primer/styled-react Major

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

Copy link
Contributor

github-actions bot commented Sep 5, 2025

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Sep 5, 2025
Copy link
Contributor

github-actions bot commented Sep 5, 2025

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 88.57 KB (-0.08% 🔽)
packages/react/dist/browser.umd.js 88.63 KB (-0.11% 🔽)

@github-actions github-actions bot added integration-tests: failing Changes in this PR cause breaking changes in gh/gh and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Sep 8, 2025
@github-actions github-actions bot temporarily deployed to storybook-preview-6741 September 8, 2025 18:14 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-6741 September 8, 2025 20:15 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-6741 September 8, 2025 20:23 Inactive
@liuliu-dev liuliu-dev force-pushed the liuliu/remove-sx-from-segmentcontrol branch from 363f0f4 to 637b0d3 Compare September 8, 2025 20:32
@github-actions github-actions bot temporarily deployed to storybook-preview-6741 September 8, 2025 20:40 Inactive
@github-actions github-actions bot requested a deployment to storybook-preview-6741 September 9, 2025 16:31 Abandoned
@primer-integration
Copy link

👋 Hi from github/github-ui! Your integration PR is ready: https://github.com/github/github-ui/pull/2155

@primer-integration
Copy link

🟢 ci completed with status success.

@github-actions github-actions bot added integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh and removed integration-tests: failing Changes in this PR cause breaking changes in gh/gh labels Sep 9, 2025
@liuliu-dev liuliu-dev marked this pull request as ready for review September 9, 2025 23:21
@Copilot Copilot AI review requested due to automatic review settings September 9, 2025 23:21
@liuliu-dev liuliu-dev requested a review from a team as a code owner September 9, 2025 23:21
@liuliu-dev liuliu-dev requested a review from joshblack September 9, 2025 23:21
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes the sx prop from the SegmentedControl component and its sub-components (Button and IconButton), aligning with the broader effort to phase out styled-system support from Primer React components. The change updates both the main React package and the styled-react compatibility package to maintain backwards compatibility.

  • Removes sx prop support from SegmentedControl, SegmentedControlButton, and SegmentedControlIconButton components
  • Adds compatibility wrappers in the styled-react package to preserve sx functionality for legacy consumers
  • Updates component exports, documentation, and tests to reflect the removal

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/styled-react/src/index.tsx Adds SegmentedControl wrapper components that preserve sx prop functionality
packages/styled-react/src/tests/primer-react.browser.test.tsx Updates tests to verify sx prop support in styled-react package
packages/react/src/index.ts Exports SegmentedControl type definitions
packages/react/src/tests/snapshots/exports.test.ts.snap Updates snapshot with new exported types
packages/react/src/SegmentedControl/index.ts Exports component type definitions
packages/react/src/SegmentedControl/SegmentedControlIconButton.tsx Removes sx prop and BoxWithFallback usage
packages/react/src/SegmentedControl/SegmentedControlButton.tsx Removes sx prop and BoxWithFallback usage
packages/react/src/SegmentedControl/SegmentedControl.tsx Removes sx prop, exports type, and removes BoxWithFallback usage
packages/react/src/SegmentedControl/SegmentedControl.docs.json Removes sx prop from documentation
packages/react/src/SegmentedControl/SegmentedControl.dev.stories.tsx Removes sx-related stories
e2e/components/SegmentedControl.test.ts Removes tests for sx-related stories
.changeset/witty-chicken-leave.md Documents breaking change

Comment on lines +204 to +205
// Width is now handled by CSS: 32px default, 100% when data-full-width is set on parent
className={classes.IconButton}
Copy link
Preview

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment mentions that width is handled by CSS using classes.IconButton, but this class is not defined in the visible changes and may not actually handle the width styling that was previously managed by the sx prop. This could result in incorrect styling behavior.

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reusing the IconButton className in SegmentedControl.module.css

Copy link
Contributor

github-actions bot commented Sep 10, 2025

Uh oh! @liuliu-dev, at least one image you shared is missing helpful alt text. Check your pull request body to fix the following violations:

  • Images should have meaningful alternative text (alt text) at line 8

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

🤖 Beep boop! This comment was added automatically by github/accessibility-alt-text-bot.

@liuliu-dev liuliu-dev added this pull request to the merge queue Sep 11, 2025
Merged via the queue into main with commit 4896ef1 Sep 11, 2025
47 checks passed
@liuliu-dev liuliu-dev deleted the liuliu/remove-sx-from-segmentcontrol branch September 11, 2025 21:32
@primer primer bot mentioned this pull request Sep 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants