react-button - Simplify prop merging#18814
Conversation
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: 862d142c760b40df8c21a43b41bf513c153df69e (build) |
|
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 fbcdb33:
|
Perf Analysis (
|
| Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
|---|---|---|---|---|---|
| ButtonNext | mount | 518 | 554 | 5000 | Possible regression |
All results
| Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
|---|---|---|---|---|---|
| Avatar | mount | 1077 | 1093 | 5000 | |
| BaseButton | mount | 1059 | 1063 | 5000 | |
| Breadcrumb | mount | 2838 | 2796 | 1000 | |
| ButtonNext | mount | 518 | 554 | 5000 | Possible regression |
| Checkbox | mount | 1773 | 1791 | 5000 | |
| CheckboxBase | mount | 1537 | 1514 | 5000 | |
| ChoiceGroup | mount | 5316 | 5402 | 5000 | |
| ComboBox | mount | 1058 | 1100 | 1000 | |
| CommandBar | mount | 10849 | 10897 | 1000 | |
| ContextualMenu | mount | 6950 | 6919 | 1000 | |
| DefaultButton | mount | 1309 | 1310 | 5000 | |
| DetailsRow | mount | 4096 | 4050 | 5000 | |
| DetailsRowFast | mount | 4169 | 4067 | 5000 | |
| DetailsRowNoStyles | mount | 3921 | 3987 | 5000 | |
| Dialog | mount | 2629 | 2650 | 1000 | |
| DocumentCardTitle | mount | 196 | 194 | 1000 | |
| Dropdown | mount | 3631 | 3613 | 5000 | |
| FluentProviderNext | mount | 3389 | 3397 | 5000 | |
| FluentProviderWithTheme | mount | 231 | 217 | 10 | |
| FluentProviderWithTheme | virtual-rerender | 107 | 113 | 10 | |
| FluentProviderWithTheme | virtual-rerender-with-unmount | 252 | 252 | 10 | |
| FocusTrapZone | mount | 2036 | 1954 | 5000 | |
| FocusZone | mount | 1926 | 1954 | 5000 | |
| IconButton | mount | 2016 | 2007 | 5000 | |
| Label | mount | 387 | 375 | 5000 | |
| Layer | mount | 3367 | 3376 | 5000 | |
| Link | mount | 537 | 532 | 5000 | |
| MakeStyles | mount | 1938 | 1946 | 50000 | |
| MenuButton | mount | 1721 | 1672 | 5000 | |
| MessageBar | mount | 2160 | 2219 | 5000 | |
| Nav | mount | 3657 | 3636 | 1000 | |
| OverflowSet | mount | 1240 | 1251 | 5000 | |
| Panel | mount | 2511 | 2540 | 1000 | |
| Persona | mount | 927 | 921 | 1000 | |
| Pivot | mount | 1584 | 1601 | 1000 | |
| PrimaryButton | mount | 1470 | 1482 | 5000 | |
| Rating | mount | 8915 | 8825 | 5000 | |
| SearchBox | mount | 1560 | 1566 | 5000 | |
| Shimmer | mount | 2903 | 2939 | 5000 | |
| Slider | mount | 2155 | 2168 | 5000 | |
| SpinButton | mount | 5544 | 5580 | 5000 | |
| Spinner | mount | 492 | 470 | 5000 | |
| SplitButton | mount | 3490 | 3514 | 5000 | |
| Stack | mount | 567 | 583 | 5000 | |
| StackWithIntrinsicChildren | mount | 1975 | 1985 | 5000 | |
| StackWithTextChildren | mount | 5399 | 5378 | 5000 | |
| SwatchColorPicker | mount | 11447 | 11518 | 5000 | |
| Tabs | mount | 1557 | 1604 | 1000 | |
| TagPicker | mount | 2955 | 2981 | 5000 | |
| TeachingBubble | mount | 13740 | 13776 | 5000 | |
| Text | mount | 487 | 476 | 5000 | |
| TextField | mount | 1580 | 1587 | 5000 | |
| ThemeProvider | mount | 1306 | 1310 | 5000 | |
| ThemeProvider | virtual-rerender | 654 | 660 | 5000 | |
| ThemeProvider | virtual-rerender-with-unmount | 2129 | 2091 | 5000 | |
| Toggle | mount | 916 | 920 | 5000 | |
| buttonNative | mount | 150 | 153 | 5000 |
Perf Analysis (@fluentui/react-northstar)
Perf tests with no regressions
| Scenario | Current PR Ticks | Baseline Ticks | Ratio |
|---|---|---|---|
| ChatDuplicateMessagesPerf.default | 356 | 325 | 1.1:1 |
| ChatWithPopoverPerf.default | 464 | 427 | 1.09:1 |
| RefMinimalPerf.default | 267 | 246 | 1.09:1 |
| BoxMinimalPerf.default | 407 | 381 | 1.07:1 |
| TreeWith60ListItems.default | 215 | 203 | 1.06:1 |
| AttachmentMinimalPerf.default | 199 | 190 | 1.05:1 |
| AvatarMinimalPerf.default | 239 | 227 | 1.05:1 |
| GridMinimalPerf.default | 405 | 387 | 1.05:1 |
| TreeMinimalPerf.default | 932 | 888 | 1.05:1 |
| CarouselMinimalPerf.default | 544 | 525 | 1.04:1 |
| FlexMinimalPerf.default | 333 | 320 | 1.04:1 |
| HeaderSlotsPerf.default | 881 | 848 | 1.04:1 |
| InputMinimalPerf.default | 1489 | 1434 | 1.04:1 |
| LabelMinimalPerf.default | 447 | 429 | 1.04:1 |
| ListWith60ListItems.default | 755 | 728 | 1.04:1 |
| RadioGroupMinimalPerf.default | 530 | 508 | 1.04:1 |
| MenuButtonMinimalPerf.default | 1898 | 1841 | 1.03:1 |
| IconMinimalPerf.default | 743 | 723 | 1.03:1 |
| AttachmentSlotsPerf.default | 1241 | 1222 | 1.02:1 |
| FormMinimalPerf.default | 484 | 474 | 1.02:1 |
| HeaderMinimalPerf.default | 417 | 409 | 1.02:1 |
| ListCommonPerf.default | 742 | 727 | 1.02:1 |
| ListNestedPerf.default | 653 | 638 | 1.02:1 |
| SkeletonMinimalPerf.default | 414 | 405 | 1.02:1 |
| StatusMinimalPerf.default | 801 | 786 | 1.02:1 |
| TableMinimalPerf.default | 469 | 462 | 1.02:1 |
| CustomToolbarPrototype.default | 4583 | 4507 | 1.02:1 |
| ButtonOverridesMissPerf.default | 1988 | 1974 | 1.01:1 |
| CheckboxMinimalPerf.default | 3018 | 2994 | 1.01:1 |
| DatepickerMinimalPerf.default | 6096 | 6035 | 1.01:1 |
| DropdownManyItemsPerf.default | 805 | 796 | 1.01:1 |
| DropdownMinimalPerf.default | 3428 | 3400 | 1.01:1 |
| ImageMinimalPerf.default | 441 | 437 | 1.01:1 |
| LayoutMinimalPerf.default | 420 | 417 | 1.01:1 |
| ListMinimalPerf.default | 586 | 579 | 1.01:1 |
| MenuMinimalPerf.default | 958 | 945 | 1.01:1 |
| RosterPerf.default | 1404 | 1397 | 1.01:1 |
| PopupMinimalPerf.default | 652 | 645 | 1.01:1 |
| AnimationMinimalPerf.default | 459 | 459 | 1:1 |
| EmbedMinimalPerf.default | 4720 | 4716 | 1:1 |
| LoaderMinimalPerf.default | 767 | 765 | 1:1 |
| PortalMinimalPerf.default | 192 | 192 | 1:1 |
| ProviderMergeThemesPerf.default | 1820 | 1811 | 1:1 |
| ReactionMinimalPerf.default | 441 | 442 | 1:1 |
| SplitButtonMinimalPerf.default | 4751 | 4774 | 1:1 |
| ToolbarMinimalPerf.default | 1065 | 1066 | 1:1 |
| CardMinimalPerf.default | 647 | 656 | 0.99:1 |
| DialogMinimalPerf.default | 815 | 827 | 0.99:1 |
| ItemLayoutMinimalPerf.default | 1384 | 1404 | 0.99:1 |
| SliderMinimalPerf.default | 1851 | 1875 | 0.99:1 |
| TableManyItemsPerf.default | 2244 | 2267 | 0.99:1 |
| TextMinimalPerf.default | 404 | 408 | 0.99:1 |
| TooltipMinimalPerf.default | 1160 | 1176 | 0.99:1 |
| ButtonMinimalPerf.default | 214 | 218 | 0.98:1 |
| ProviderMinimalPerf.default | 1246 | 1275 | 0.98:1 |
| SegmentMinimalPerf.default | 404 | 413 | 0.98:1 |
| ButtonSlotsPerf.default | 622 | 638 | 0.97:1 |
| ChatMinimalPerf.default | 735 | 757 | 0.97:1 |
| DividerMinimalPerf.default | 420 | 435 | 0.97:1 |
| VideoMinimalPerf.default | 705 | 725 | 0.97:1 |
| AlertMinimalPerf.default | 307 | 324 | 0.95:1 |
| TextAreaMinimalPerf.default | 596 | 626 | 0.95:1 |
| AccordionMinimalPerf.default | 172 | 184 | 0.93:1 |
layershifter
left a comment
There was a problem hiding this comment.
Looks that this PR has merge conflicts, @bsunderhus can you please rebase it first?
I'll keep this PR on hold for now, as some divergent discussions are appearing on the subject |
|
As #19483 was merged, this is not blocked anymore. |
3a05e23 to
420362c
Compare
📊 Bundle size reportUnchanged fixtures
|
| >((props, ref) => { | ||
| export const Button: React.ForwardRefExoticComponent< | ||
| ButtonProps & React.RefAttributes<HTMLButtonElement> | ||
| > = React.forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => { |
There was a problem hiding this comment.
declaring ForwardRefExoticComponent is a bit tangled up in Ben's forwardRef PR and Elizabeth's follow-on PR. @ecraig12345 - What should the declaration be if any?
There was a problem hiding this comment.
Let's keep that separate since the resolution is still not known on that one.
| return <slots.root {...slotProps.root}>this is an anchor</slots.root>; | ||
| }; | ||
|
|
||
| export const Span = (args: DefaultArgs) => { |
| shorthand.onKeyDown = onKeyDownHandler; | ||
| shorthand.onKeyUp = onKeyupHandler; | ||
| shorthand.role = shorthand.role ?? 'button'; | ||
| shorthand.tabIndex = disabled && !disabledFocusable ? undefined : tabIndex ?? 0; |
There was a problem hiding this comment.
I half wonder if there's a way to mandate an href attribute if someone wants as: a, since otherwise it's effectively as: span, and then we don't need to do the weird keydown vs. keyup enter key dance. And also then we wouldn't need to specify tabindex unless it's disabled :)
There was a problem hiding this comment.
I think this is something that we should explore, but this PR is very large as is, so I'll leave it till later to investigate this.
| gap: buttonSpacing.smaller, | ||
| padding: `0 ${buttonSpacing.medium}`, | ||
|
|
||
| height: '24px', |
There was a problem hiding this comment.
Not for this PR, but we should probably adjust this to use padding/lineheight so the button text can wrap OK (I'll add it to the a11y issue 😄)
…implify-prop-merging-react-button
* Updates button to simplify prop merging * Change files * Fix lint issues * Adds react-aria deps * Updates deps on react-accordion * Change files * Updates tests * Change files * Updates change * Updates deps * Updates deps * Removes ExtractRef usage * Updates API * Updates deps * Updates lock * Change files * Updating API to reflect aria button changes. * Change files * Removing type explosion. * Fixing SplitButton fixture name. * PR feedback. * Updating package.json with newest versions. * Updating comments in ToggleButton. * Using getNativeElementProps in button. * Bumping version of react-aria in react-button * Invert names from argument and internal declaration on shorthands * Update API Co-authored-by: KHMakoto <Humberto.Morimoto@microsoft.com> Co-authored-by: Lingfan Gao <lingfangao@hotmail.com>
Pull request checklist
$ yarn changeDescription of changes
Implements changes proposed by the RFC #18721 on
react-button