Skip to content

fix: update Select to correctly merge classes #6124

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

Merged
merged 2 commits into from
May 28, 2025

Conversation

joshblack
Copy link
Member

Closes #6067

Changelog

New

Changed

  • Update Select to correctly merge classes when className is provided

Removed

Rollout strategy

  • Patch release

@Copilot Copilot AI review requested due to automatic review settings May 28, 2025 15:29
@joshblack joshblack requested a review from a team as a code owner May 28, 2025 15:29
@joshblack joshblack requested a review from TylerJDev May 28, 2025 15:29
Copy link

changeset-bot bot commented May 28, 2025

🦋 Changeset detected

Latest commit: 186d6e0

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

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

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

@github-actions github-actions bot added the staff Author is a staff member label May 28, 2025
@joshblack joshblack changed the title Fix/update select class name fix: update Select to correctly merge classes May 28, 2025
@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 May 28, 2025
Copy link
Contributor

👋 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!

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 patch ensures that consumer-provided className values are merged with the component’s internal classes instead of being overwritten.

  • Destructure className from props and merge it with classes.Select (and classes.Disabled when applicable) via clsx.
  • Move the {...rest} spread above the className prop so that incoming props don’t override the merged classes.
  • Add a changeset for a patch release.

Reviewed Changes

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

File Description
packages/react/src/Select/Select.tsx Destructure className, adjust prop spread order, and merge classes via clsx
.changeset/quiet-sides-slide.md Add patch-level changeset documenting updated class merging behavior
Comments suppressed due to low confidence (1)

packages/react/src/Select/Select.tsx:68

  • Add tests for rendering the Select component with a custom className to ensure classes are merged correctly when className is provided.
className={clsx(className, classes.Select, disabled && classes.Disabled)}

Copy link
Contributor

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 94.47 KB (+0.14% 🔺)
packages/react/dist/browser.umd.js 94.54 KB (+0.05% 🔺)

@joshblack joshblack added this pull request to the merge queue May 28, 2025
Merged via the queue into main with commit ad5e73b May 28, 2025
40 checks passed
@joshblack joshblack deleted the fix/update-select-class-name branch May 28, 2025 16:50
@primer primer bot mentioned this pull request May 28, 2025
@primer-integration
Copy link

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

@primer-integration
Copy link

🔴 golden-jobs completed with status failure.

@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 May 29, 2025
francinelucca added a commit that referenced this pull request May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration-tests: failing Changes in this PR cause breaking changes in gh/gh staff Author is a staff member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Select component regains default browser styling when passed className
2 participants