-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
chore: refactor styles for Button #25216
chore: refactor styles for Button #25216
Conversation
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 acc7525:
|
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: 388133213c27c5b72276621b64c1eff46504d971 (build) |
📊 Bundle size reportUnchanged fixtures
|
Perf Analysis (
|
Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
---|---|---|---|---|---|
Avatar | mount | 1306 | 1347 | 5000 | |
Button | mount | 950 | 931 | 5000 | |
FluentProvider | mount | 1624 | 1597 | 5000 | |
FluentProviderWithTheme | mount | 636 | 632 | 10 | |
FluentProviderWithTheme | virtual-rerender | 603 | 594 | 10 | |
FluentProviderWithTheme | virtual-rerender-with-unmount | 628 | 633 | 10 | |
MakeStyles | mount | 1910 | 1933 | 50000 | |
SpinButton | mount | 2552 | 2617 | 5000 |
Perf Analysis (
|
Scenario | Current PR Ticks | Baseline Ticks | Ratio |
---|---|---|---|
RefMinimalPerf.default | 243 | 218 | 1.11:1 |
ButtonMinimalPerf.default | 196 | 181 | 1.08:1 |
SkeletonMinimalPerf.default | 398 | 367 | 1.08:1 |
TableMinimalPerf.default | 459 | 426 | 1.08:1 |
TextAreaMinimalPerf.default | 582 | 538 | 1.08:1 |
DividerMinimalPerf.default | 411 | 383 | 1.07:1 |
FlexMinimalPerf.default | 317 | 295 | 1.07:1 |
FormMinimalPerf.default | 443 | 414 | 1.07:1 |
BoxMinimalPerf.default | 385 | 363 | 1.06:1 |
ButtonSlotsPerf.default | 632 | 600 | 1.05:1 |
CardMinimalPerf.default | 615 | 587 | 1.05:1 |
LabelMinimalPerf.default | 439 | 420 | 1.05:1 |
CarouselMinimalPerf.default | 514 | 496 | 1.04:1 |
ChatDuplicateMessagesPerf.default | 297 | 285 | 1.04:1 |
PortalMinimalPerf.default | 171 | 164 | 1.04:1 |
GridMinimalPerf.default | 387 | 376 | 1.03:1 |
PopupMinimalPerf.default | 680 | 662 | 1.03:1 |
RadioGroupMinimalPerf.default | 495 | 481 | 1.03:1 |
SegmentMinimalPerf.default | 386 | 374 | 1.03:1 |
TooltipMinimalPerf.default | 2595 | 2520 | 1.03:1 |
AttachmentMinimalPerf.default | 172 | 169 | 1.02:1 |
AvatarMinimalPerf.default | 210 | 205 | 1.02:1 |
DropdownMinimalPerf.default | 2857 | 2803 | 1.02:1 |
InputMinimalPerf.default | 1249 | 1225 | 1.02:1 |
ItemLayoutMinimalPerf.default | 1314 | 1282 | 1.02:1 |
SplitButtonMinimalPerf.default | 4833 | 4759 | 1.02:1 |
TreeMinimalPerf.default | 889 | 874 | 1.02:1 |
VideoMinimalPerf.default | 842 | 828 | 1.02:1 |
AttachmentSlotsPerf.default | 1203 | 1191 | 1.01:1 |
ChatMinimalPerf.default | 801 | 795 | 1.01:1 |
CheckboxMinimalPerf.default | 2291 | 2268 | 1.01:1 |
EmbedMinimalPerf.default | 4051 | 4030 | 1.01:1 |
ImageMinimalPerf.default | 440 | 436 | 1.01:1 |
ListNestedPerf.default | 619 | 611 | 1.01:1 |
MenuMinimalPerf.default | 925 | 913 | 1.01:1 |
RosterPerf.default | 2379 | 2351 | 1.01:1 |
ReactionMinimalPerf.default | 430 | 427 | 1.01:1 |
ButtonOverridesMissPerf.default | 1445 | 1442 | 1:1 |
DatepickerMinimalPerf.default | 6206 | 6187 | 1:1 |
HeaderMinimalPerf.default | 387 | 387 | 1:1 |
HeaderSlotsPerf.default | 844 | 844 | 1:1 |
SliderMinimalPerf.default | 1750 | 1749 | 1:1 |
TableManyItemsPerf.default | 2132 | 2130 | 1:1 |
CustomToolbarPrototype.default | 2793 | 2781 | 1:1 |
ChatWithPopoverPerf.default | 396 | 401 | 0.99:1 |
DialogMinimalPerf.default | 823 | 834 | 0.99:1 |
LayoutMinimalPerf.default | 391 | 394 | 0.99:1 |
ListMinimalPerf.default | 564 | 568 | 0.99:1 |
MenuButtonMinimalPerf.default | 1837 | 1856 | 0.99:1 |
StatusMinimalPerf.default | 746 | 750 | 0.99:1 |
TextMinimalPerf.default | 367 | 371 | 0.99:1 |
ToolbarMinimalPerf.default | 1008 | 1014 | 0.99:1 |
DropdownManyItemsPerf.default | 747 | 759 | 0.98:1 |
ListWith60ListItems.default | 673 | 684 | 0.98:1 |
LoaderMinimalPerf.default | 702 | 715 | 0.98:1 |
ProviderMergeThemesPerf.default | 1298 | 1329 | 0.98:1 |
ProviderMinimalPerf.default | 410 | 420 | 0.98:1 |
TreeWith60ListItems.default | 169 | 173 | 0.98:1 |
AnimationMinimalPerf.default | 561 | 579 | 0.97:1 |
ListCommonPerf.default | 678 | 701 | 0.97:1 |
AccordionMinimalPerf.default | 157 | 163 | 0.96:1 |
IconMinimalPerf.default | 718 | 754 | 0.95:1 |
AlertMinimalPerf.default | 276 | 299 | 0.92:1 |
Perf Analysis (
|
Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
---|---|---|---|---|---|
BaseButton | mount | 1201 | 1210 | 5000 | |
Breadcrumb | mount | 2772 | 2784 | 1000 | |
Checkbox | mount | 2623 | 2660 | 5000 | |
CheckboxBase | mount | 2363 | 2363 | 5000 | |
ChoiceGroup | mount | 4240 | 4278 | 5000 | |
ComboBox | mount | 1166 | 1179 | 1000 | |
CommandBar | mount | 9282 | 9275 | 1000 | |
ContextualMenu | mount | 10129 | 10133 | 1000 | |
DefaultButton | mount | 1358 | 1369 | 5000 | |
DetailsRow | mount | 3392 | 3381 | 5000 | |
DetailsRowFast | mount | 3398 | 3387 | 5000 | |
DetailsRowNoStyles | mount | 3256 | 3220 | 5000 | |
Dialog | mount | 2910 | 2978 | 1000 | |
DocumentCardTitle | mount | 570 | 584 | 1000 | |
Dropdown | mount | 3167 | 3177 | 5000 | |
FocusTrapZone | mount | 1950 | 1957 | 5000 | |
FocusZone | mount | 1938 | 1926 | 5000 | |
GroupedList | mount | 48466 | 53144 | 2 | |
GroupedList | virtual-rerender | 22878 | 23119 | 2 | |
GroupedList | virtual-rerender-with-unmount | 81374 | 82522 | 2 | |
GroupedListV2 | mount | 552 | 567 | 2 | |
GroupedListV2 | virtual-rerender | 530 | 530 | 2 | |
GroupedListV2 | virtual-rerender-with-unmount | 552 | 547 | 2 | |
IconButton | mount | 1790 | 1795 | 5000 | |
Label | mount | 746 | 761 | 5000 | |
Layer | mount | 4135 | 4147 | 5000 | |
Link | mount | 846 | 859 | 5000 | |
MenuButton | mount | 1629 | 1599 | 5000 | |
MessageBar | mount | 2413 | 2339 | 5000 | |
Nav | mount | 3071 | 3068 | 1000 | |
OverflowSet | mount | 1407 | 1427 | 5000 | |
Panel | mount | 2491 | 2487 | 1000 | |
Persona | mount | 1238 | 1252 | 1000 | |
Pivot | mount | 1526 | 1540 | 1000 | |
PrimaryButton | mount | 1488 | 1492 | 5000 | |
Rating | mount | 7006 | 7019 | 5000 | |
SearchBox | mount | 1493 | 1495 | 5000 | |
Shimmer | mount | 2932 | 2911 | 5000 | |
Slider | mount | 2100 | 2111 | 5000 | |
SpinButton | mount | 4312 | 4287 | 5000 | |
Spinner | mount | 810 | 825 | 5000 | |
SplitButton | mount | 2846 | 2851 | 5000 | |
Stack | mount | 858 | 857 | 5000 | |
StackWithIntrinsicChildren | mount | 2191 | 2214 | 5000 | |
StackWithTextChildren | mount | 4894 | 4896 | 5000 | |
SwatchColorPicker | mount | 9495 | 9582 | 5000 | |
TagPicker | mount | 2315 | 2311 | 5000 | |
TeachingBubble | mount | 74702 | 74543 | 5000 | |
Text | mount | 816 | 826 | 5000 | |
TextField | mount | 1538 | 1556 | 5000 | |
ThemeProvider | mount | 1458 | 1444 | 5000 | |
ThemeProvider | virtual-rerender | 1136 | 1144 | 5000 | |
ThemeProvider | virtual-rerender-with-unmount | 2005 | 1989 | 5000 | |
Toggle | mount | 1140 | 1125 | 5000 | |
buttonNative | mount | 541 | 526 | 5000 |
c20ed7f
to
f1edd10
Compare
664ceea
to
1e0602f
Compare
7d525ea
to
25a47af
Compare
0fe4903
to
11793de
Compare
11793de
to
aa30023
Compare
the perf improvements thanks to this are amazing, I'm bit worried about DX though. What's the plan in terms of enforcing/guiding devs by tooling when use |
Yeah, I am also worried and it's a reason why I was pushing myself against it 😸 (well, there are no other options) As I mentioned in PR's description: the plan is to have guidelines around our styling (when use what, how to write styles, etc.) and linting as an actionable step. For linting: rules are a bit unclear, but I will try to come with something reasonable. |
packages/react-components/react-button/src/components/Button/useButtonStyles.ts
Outdated
Show resolved
Hide resolved
packages/react-components/react-button/src/components/Button/useButtonStyles.ts
Outdated
Show resolved
Hide resolved
packages/react-components/react-button/src/components/Button/useButtonStyles.ts
Outdated
Show resolved
Hide resolved
Ran some style recalc performance tests with stress-test: MS Edge
Mozilla Firefox
|
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.
f08c02c
to
444bef6
Compare
🕵 fluentuiv9 Open the Visual Regressions report to inspect the 2 screenshots✅ There was 0 screenshots added, 0 screenshots removed, 1752 screenshots unchanged, 0 screenshots with different dimensions and 2 screenshots with visible difference. unknown 2 screenshots
|
packages/react-components/react-tabster/src/focus/createCustomFocusIndicatorStyle.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Makoto Morimoto <[email protected]>
* master: BREAKING: `useTable` renamed to `useTableFeatures` (microsoft#25797) chore: add retries for navigation in ssr-tests-v9 (microsoft#25844) fix: Cell actions should have correct background when row focused within (microsoft#25790) applying package updates Disable 3 Avatar Converged active stories (microsoft#25765) chore: introduce TS path aliases for improved DX in v8 (microsoft#25778) chore: prepare release react-northstar 0.65.0 (microsoft#25446) refactor(scripts): encapsulate v0 and v8 tooling within its domain boundaries (microsoft#25738) Support single point in area chart (microsoft#25842) chore: enable isolateModules in all v8 packages (microsoft#25774) chore: refactor styles for Button (microsoft#25216) feat: Improve docs for `DataGrid`, export as unstable (microsoft#25805) applying package updates fix: Allow data-selection-disabled to be respected by DetailsRow (microsoft#25836) docs(rfcs): Update recipes rfc with chosen option and add more details (microsoft#25823) chore(react-textarea): migrate to new package structure (microsoft#25820) chore(react-switch): migrate to new package structure (microsoft#25819) fix(react-avatar): AvatarGroup's pie layout places inline items correctly in rtl (microsoft#25822) chore: add few improvements to toolbar stories (microsoft#25635)
* chore: refactor styles for Button * refactor createCustomFocusIndicatorStyle to allow CSS shorthands * change file * Apply suggestions from code review Co-authored-by: Makoto Morimoto <[email protected]> Co-authored-by: Makoto Morimoto <[email protected]>
Fixes #25353.
What changes?
This PR refactors
Button
component to usemakeResetStyles
. The goal is to improve layouting performance by reducing an amount of applied CSS classes to an element.The goal is to apply this change to all components (I am working on RFC to explain details), for simplicity:
makeResetStyles
disabled
,appearance
) are defined withmakeStyles
Notes
makeResetStyles
can be applied to a slotmakeResetStyles
allows to use CSS shorthandsmakeResetStyles
supports AOT and CSS extraction asmakeStyles
Results
button
element)<Button />
<Button appearance="primary" />
<Button disabled />
<Button appearance="primary" disabled />