chore: Improve ability to override Checkbox and Radio styles#26004
Closed
behowell wants to merge 4 commits intomicrosoft:masterfrom
Closed
chore: Improve ability to override Checkbox and Radio styles#26004behowell wants to merge 4 commits intomicrosoft:masterfrom
behowell wants to merge 4 commits intomicrosoft:masterfrom
Conversation
Asset size changesUnable to find bundle size details for Baseline commit: a98c062 Possible causes
Recommendations
|
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit fbba566:
|
Collaborator
Perf Analysis (
|
| Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
|---|---|---|---|---|---|
| Avatar | mount | 1271 | 1277 | 5000 | |
| Button | mount | 909 | 908 | 5000 | |
| FluentProvider | mount | 1501 | 1480 | 5000 | |
| FluentProviderWithTheme | mount | 575 | 582 | 10 | |
| FluentProviderWithTheme | virtual-rerender | 538 | 548 | 10 | |
| FluentProviderWithTheme | virtual-rerender-with-unmount | 579 | 581 | 10 | |
| MakeStyles | mount | 1972 | 1946 | 50000 | |
| Persona | mount | 2785 | 2814 | 5000 | |
| SpinButton | mount | 2299 | 2358 | 5000 |
Collaborator
📊 Bundle size reportUnchanged fixtures
|
Collaborator
🕵 fluentuiv9 No visual regressions between this PR and main |
packages/react-components/react-checkbox/src/components/Checkbox/useCheckboxStyles.ts
Outdated
Show resolved
Hide resolved
Contributor
Author
|
I made another PR with an alternative way to make styles easier to override. Only one of the two PRs will be merged, pending discussion with interested people: |
…heckbox/css-internal-vars
Contributor
Author
|
After discussing with the team, we decided to go with #26247 instead. |
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.

Previous Behavior
The styles for Checkbox and Radio use complex state and sibling selectors, which can be tricky to override correctly. See #25483 for more details.
New Behavior
For any color set via a selector in Checkbox and Radio, set the value of a CSS variable rather than the CSS property directly. Then in that slot's base styles (no selectors), apply the current value of the CSS variable.
This eliminates any specificity issues when overriding the CSS properties for any given slot. Users can now override the values for any slot using any selector they would like. For example:
Related Issue(s)