-
Notifications
You must be signed in to change notification settings - Fork 647
fix(Autocomplete.Overlay): prevent user-defined className from overriding default styles #7364
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?
fix(Autocomplete.Overlay): prevent user-defined className from overriding default styles #7364
Conversation
…ding default styles
🦋 Changeset detectedLatest commit: 4f74127 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 |
|
👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Or, apply the |
Prevent user-defined className from overriding default styles in Autocomplete.Overlay.
…e-overridden-by-user
…e-overridden-by-user
|
👋 Hi from github/github-ui! Your integration PR is ready: https://github.com/github/github-ui/pull/9459 |
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.
Pull request overview
This PR fixes a bug where user-defined className props were overriding default styles in the Autocomplete.Overlay component instead of being merged with them. The fix uses the clsx utility to properly merge CSS classes, ensuring both default and custom classes are applied.
Key changes:
- Refactored
AutocompleteOverlayto merge the user-providedclassNameprop with the defaultclasses.Overlayclass usingclsx - Re-enabled and updated the previously skipped
Autocomplete.OverlayclassName test with proper context mocking
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
packages/react/src/Autocomplete/AutocompleteOverlay.tsx |
Added clsx import and updated className handling to merge default and custom classes |
packages/react/src/Autocomplete/Autocomplete.test.tsx |
Re-enabled className test with complete AutocompleteContext mock to ensure overlay is properly rendered |
.changeset/dry-carrots-bathe.md |
Added changeset documenting the patch-level fix |
Closes https://github.com/github/primer/issues/6289
Changelog
Changed
AutocompleteOverlayto mergeclassNameprop with default style classAutocomplete.OverlayclassName test by mocking the context and usingAutocompleteContext.Providerto ensure the overlay menu is shownRollout strategy
Testing & Reviewing
Merge checklist