fix(merge-styles): Correctly processing selectors when value is a class name and they are not wrapped in selectors wrapper#31798
Merged
khmakoto merged 2 commits intoJun 24, 2024
Conversation
…ss name and they are not wrapped in 'selectors' wrapper.
Collaborator
📊 Bundle size reportUnchanged fixtures
|
fabricteam
reviewed
Jun 24, 2024
Collaborator
Perf Analysis (
|
| Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
|---|---|---|---|---|---|
| BaseButton | mount | 617 | 622 | 5000 | |
| Breadcrumb | mount | 1687 | 1675 | 1000 | |
| Checkbox | mount | 1683 | 1740 | 5000 | |
| CheckboxBase | mount | 1493 | 1459 | 5000 | |
| ChoiceGroup | mount | 2974 | 3025 | 5000 | |
| ComboBox | mount | 665 | 655 | 1000 | |
| CommandBar | mount | 6467 | 6540 | 1000 | |
| ContextualMenu | mount | 12808 | 12674 | 1000 | |
| DefaultButton | mount | 785 | 791 | 5000 | |
| DetailsRow | mount | 2203 | 2218 | 5000 | |
| DetailsRowFast | mount | 2226 | 2221 | 5000 | |
| DetailsRowNoStyles | mount | 2037 | 2025 | 5000 | |
| Dialog | mount | 2759 | 2767 | 1000 | |
| DocumentCardTitle | mount | 217 | 222 | 1000 | |
| Dropdown | mount | 2001 | 1978 | 5000 | |
| FocusTrapZone | mount | 1145 | 1168 | 5000 | |
| FocusZone | mount | 1103 | 1084 | 5000 | |
| GroupedList | mount | 41827 | 42340 | 2 | |
| GroupedList | virtual-rerender | 18010 | 20365 | 2 | |
| GroupedList | virtual-rerender-with-unmount | 51045 | 50861 | 2 | |
| GroupedListV2 | mount | 231 | 232 | 2 | |
| GroupedListV2 | virtual-rerender | 202 | 215 | 2 | |
| GroupedListV2 | virtual-rerender-with-unmount | 221 | 234 | 2 | |
| IconButton | mount | 1126 | 1115 | 5000 | |
| Label | mount | 341 | 345 | 5000 | |
| Layer | mount | 2703 | 2725 | 5000 | |
| Link | mount | 394 | 397 | 5000 | |
| MenuButton | mount | 968 | 980 | 5000 | |
| MessageBar | mount | 21353 | 21327 | 5000 | |
| Nav | mount | 2025 | 2051 | 1000 | |
| OverflowSet | mount | 781 | 788 | 5000 | |
| Panel | mount | 1841 | 1788 | 1000 | |
| Persona | mount | 754 | 755 | 1000 | |
| Pivot | mount | 916 | 908 | 1000 | |
| PrimaryButton | mount | 914 | 925 | 5000 | |
| Rating | mount | 4772 | 4584 | 5000 | |
| SearchBox | mount | 921 | 936 | 5000 | |
| Shimmer | mount | 1850 | 1873 | 5000 | |
| Slider | mount | 1330 | 1322 | 5000 | |
| SpinButton | mount | 2984 | 2957 | 5000 | |
| Spinner | mount | 391 | 392 | 5000 | |
| SplitButton | mount | 1878 | 1852 | 5000 | |
| Stack | mount | 418 | 430 | 5000 | |
| StackWithIntrinsicChildren | mount | 833 | 885 | 5000 | |
| StackWithTextChildren | mount | 2669 | 2743 | 5000 | |
| SwatchColorPicker | mount | 6474 | 6499 | 5000 | |
| TagPicker | mount | 1444 | 1416 | 5000 | |
| Text | mount | 383 | 396 | 5000 | |
| TextField | mount | 914 | 917 | 5000 | |
| ThemeProvider | mount | 834 | 848 | 5000 | |
| ThemeProvider | virtual-rerender | 586 | 582 | 5000 | |
| ThemeProvider | virtual-rerender-with-unmount | 1275 | 1316 | 5000 | |
| Toggle | mount | 603 | 609 | 5000 | |
| buttonNative | mount | 182 | 185 | 5000 |
spmonahan
approved these changes
Jun 24, 2024
khmakoto
deleted the
fix/merge-styles/classNamesAreCorrectlyPassedToSelectors
branch
June 24, 2024 23:09
marcosmoura
added a commit
to marcosmoura/fluentui
that referenced
this pull request
Jun 26, 2024
* master: (90 commits) fix(react-drawer): do not create global header/footer roles (microsoft#31799) release: applying package updates - react v8 release: applying package updates - web-components Add 'allowParentArrowNavigation' prop to `ComboBox`. (microsoft#31805) Add drawer web component (microsoft#31521) fix: MenuButton is styled correctly when aria-expanded is a string (microsoft#31809) chore: Updating version of `@fluentui/react-icons` to `^2.0.245` (microsoft#31802) chore:(docs) Migrate e2e Cypress testing doc (microsoft#31796) chore:(docs) Update API Extractor file (microsoft#31651) chore: migrate to nx 18 (microsoft#31746) release: applying package updates - react v8 release: applying package updates - web-components feat: update text to use element internals for custom states (microsoft#31770) chore(web-components): Remove define imports from story modules (microsoft#31622) fix(`merge-styles`): Correctly processing selectors when value is a class name and they are not wrapped in `selectors` wrapper (microsoft#31798) style(react-combobox): turn off react-compiler lints for non compliant code (microsoft#31795) docs: Add AriaLiveAnnouncer to all examples (microsoft#31794) fix(public-docsite-v9): disable storybook keyboard shortcuts (microsoft#31762) feat: V0 Attachment compact component (microsoft#31634) release: applying package updates - react v8 ...
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
After #31253 was merged and the
selectorswrapper was removed from every button style, it was discovered that some style customizations were no longer working, such as the one in this Stackblitz project where therootFocusedstyle customizations are not being applied.After some investigation, I discovered that the
selectorswrapper forced a path withinextractRulesto actually go through theextractSelectorprocess, which ensured that the pseudo selectors were being properly handled. In contrast, not applying the wrapper meant that the logic checked for the value of the pseudo selector being an object, a case that is handled correctly, but the same logic doesn't apply when the value is just a class name as in the example above.This is something that has never worked but that hadn't been exposed before because most of our components still use the
selectorswrapper internally.New Behavior
I have added an
isSelectorlocal function that checks for the same set of minimum conditions that the currently usedexpandSelectorchecks, and use it to determine if something needs to go through theextractSelectorcode path. This ensures that even when the value of a pseudo selector is not an object, it is treated properly.Note: I tried to add a test to shield this in the future, but since the correct behavior when the value is a string is to not add anything to the stylesheet, since the class name should presumably already be there and is just being applied to that pseudo selector, I could not really check for something else being added to the stylesheet to verify this.