Skip to content
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

ContextualMenu: Migrate existing ContextualMenu code to react-next #12992

Closed

Conversation

MLoughry
Copy link
Contributor

@MLoughry MLoughry commented May 4, 2020

Pull request checklist

  • Include a change request file using $ yarn change

Description of changes

No code changes aside from fixing import paths

Focus areas to test

(optional)

Microsoft Reviewers: Open in CodeFlow

@size-auditor
Copy link

size-auditor bot commented May 4, 2020

Asset size changes

Project Bundle Baseline Size New Size Difference
office-ui-fabric-react fluentui-react-next-ContextualMenu 148.804 kB 148.397 kB BelowBaseline     -407 bytes

ExceedsTolerance Over Tolerance (1024 B) ExceedsBaseline Over Baseline BelowBaseline Below Baseline New New Deleted  Removed 1 kB = 1000 B

Baseline commit: 039cf12124d228f15af2d7a77470a843d9149478 (build)

@msft-github-bot
Copy link
Contributor

msft-github-bot commented May 4, 2020

Perf Analysis

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
BaseButton mount 883 893 5000
ButtonNext mount 515 500 5000
Checkbox mount 1588 1631 5000
CheckboxBase mount 1318 1321 5000
CheckboxNext mount 1685 1706 5000
ChoiceGroup mount 5086 5121 5000
ComboBox mount 964 974 1000
CommandBar mount 7476 7382 1000
ContextualMenu mount 12499 12412 1000
DefaultButton mount 1151 1124 5000
DetailsRow mount 3603 3544 5000
DetailsRowFast mount 3605 3639 5000
DetailsRowNoStyles mount 3404 3423 5000
Dialog mount 1496 1452 1000
DocumentCardTitle mount 1747 1731 1000
Dropdown mount 2685 2613 5000
FocusZone mount 1707 1692 5000
IconButton mount 1819 1777 5000
Label mount 340 357 5000
Link mount 441 443 5000
LinkNext mount 502 471 5000
MenuButton mount 1488 1490 5000
Nav mount 3246 3220 1000
Panel mount 1447 1493 1000
Persona mount 839 852 1000
Pivot mount 1459 1413 1000
PivotNext mount 1370 1349 1000
PrimaryButton mount 1320 1356 5000
SearchBox mount 1372 1410 5000
Slider mount 1584 1664 5000
SliderNext mount 2024 2062 5000
Spinner mount 409 433 5000
SplitButton mount 3167 3192 5000
Stack mount 535 555 5000
StackWithIntrinsicChildren mount 2021 1952 5000
StackWithTextChildren mount 5239 5265 5000
TagPicker mount 2900 2896 5000
Text mount 442 422 5000
TextField mount 1473 1469 5000
ThemeProvider mount 2841 2752 5000
ThemeProvider virtual-rerender 488 506 5000
Toggle mount 877 867 5000
ToggleNext mount 868 843 5000
button mount 115 106 5000

Perf Analysis (Fluent)

Perf comparison
Status Scenario Fluent TPI Fabric TPI Ratio Iterations Ticks
🎯 Avatar.Fluent 0.48 0.52 0.92:1 2000 968
🦄 Button.Fluent 0.11 0.2 0.55:1 5000 556
🔧 Checkbox.Fluent 0.62 0.38 1.63:1 1000 617
🦄 Dialog.Fluent 0.15 0.22 0.68:1 5000 762
🔧 Dropdown.Fluent 3.22 0.45 7.16:1 1000 3215
🔧 Icon.Fluent 0.14 0.05 2.8:1 5000 699
🎯 Image.Fluent 0.08 0.1 0.8:1 5000 401
🔧 Slider.Fluent 1.61 0.34 4.74:1 1000 1611
🔧 Text.Fluent 0.07 0.02 3.5:1 5000 361
🦄 Tooltip.Fluent 0.1 16.58 0.01:1 5000 477

🔧 Needs work     🎯 On target     🦄 Amazing

Perf tests with no regressions
Scenario Current PR Ticks Baseline Ticks Ratio
TreeWith60ListItems.default 228 197 1.16:1
DialogMinimalPerf.default 944 848 1.11:1
LayoutMinimalPerf.default 436 395 1.1:1
ListMinimalPerf.default 513 468 1.1:1
AnimationMinimalPerf.default 463 430 1.08:1
CardMinimalPerf.default 657 612 1.07:1
PortalMinimalPerf.default 119 111 1.07:1
AttachmentMinimalPerf.default 197 185 1.06:1
DropdownManyItemsPerf.default 1613 1525 1.06:1
RadioGroupMinimalPerf.default 422 397 1.06:1
DropdownMinimalPerf.default 3875 3698 1.05:1
EmbedMinimalPerf.default 2315 2214 1.05:1
GridMinimalPerf.default 843 800 1.05:1
Avatar.Fluent 968 923 1.05:1
Slider.Fluent 1611 1535 1.05:1
AvatarMinimalPerf.default 602 579 1.04:1
ChatWithPopoverPerf.default 569 545 1.04:1
ImageMinimalPerf.default 374 360 1.04:1
Checkbox.Fluent 617 594 1.04:1
Image.Fluent 401 384 1.04:1
Tooltip.Fluent 477 457 1.04:1
FormMinimalPerf.default 491 477 1.03:1
MenuButtonMinimalPerf.default 1563 1517 1.03:1
Dialog.Fluent 762 740 1.03:1
AlertMinimalPerf.default 363 355 1.02:1
MenuMinimalPerf.default 894 878 1.02:1
ChatDuplicateMessagesPerf.default 489 484 1.01:1
ChatMinimalPerf.default 693 686 1.01:1
InputMinimalPerf.default 1018 1005 1.01:1
ListNestedPerf.default 884 879 1.01:1
RefMinimalPerf.default 192 191 1.01:1
SplitButtonMinimalPerf.default 3755 3726 1.01:1
TreeMinimalPerf.default 864 855 1.01:1
Dropdown.Fluent 3215 3168 1.01:1
ButtonMinimalPerf.default 199 199 1:1
HeaderSlotsPerf.default 883 881 1:1
HierarchicalTreeMinimalPerf.default 465 467 1:1
ListWith60ListItems.default 1110 1111 1:1
PopupMinimalPerf.default 630 631 1:1
TextAreaMinimalPerf.default 522 523 1:1
ToolbarMinimalPerf.default 945 943 1:1
TooltipMinimalPerf.default 730 727 1:1
Icon.Fluent 699 701 1:1
BoxMinimalPerf.default 390 394 0.99:1
CarouselMinimalPerf.default 530 538 0.99:1
CheckboxMinimalPerf.default 3175 3196 0.99:1
DividerMinimalPerf.default 410 414 0.99:1
HeaderMinimalPerf.default 410 416 0.99:1
LoaderMinimalPerf.default 730 734 0.99:1
ProviderMergeThemesPerf.default 2013 2029 0.99:1
SegmentMinimalPerf.default 350 352 0.99:1
ButtonSlotsPerf.default 693 707 0.98:1
LabelMinimalPerf.default 414 424 0.98:1
ListCommonPerf.default 975 991 0.98:1
ProviderMinimalPerf.default 834 851 0.98:1
ReactionMinimalPerf.default 386 394 0.98:1
StatusMinimalPerf.default 708 721 0.98:1
IconMinimalPerf.default 684 701 0.98:1
TableManyItemsPerf.default 2280 2330 0.98:1
CustomToolbarPrototype.default 3891 3956 0.98:1
Button.Fluent 556 568 0.98:1
ItemLayoutMinimalPerf.default 1374 1413 0.97:1
SliderMinimalPerf.default 1498 1550 0.97:1
VideoMinimalPerf.default 619 640 0.97:1
Text.Fluent 361 372 0.97:1
AttachmentSlotsPerf.default 1321 1376 0.96:1
FlexMinimalPerf.default 352 374 0.94:1
TableMinimalPerf.default 388 413 0.94:1
TextMinimalPerf.default 337 358 0.94:1
AccordionMinimalPerf.default 164 180 0.91:1

@MLoughry MLoughry closed this May 4, 2020
@MLoughry MLoughry reopened this May 4, 2020
@dzearing
Copy link
Member

dzearing commented May 5, 2020

confused on the conflict

@MLoughry
Copy link
Contributor Author

MLoughry commented May 5, 2020

@dzearing These conflicts happen whenever someone merges a change that copies code from OUFR, rather than importing it.

@MLoughry
Copy link
Contributor Author

MLoughry commented May 5, 2020

I'm unclear on the failing focus tests, since this change has no code changes. :(

@ecraig12345 ecraig12345 changed the title [ContextualMenu]: Migrate existing ContextualMenu code to react-next ContextualMenu: Migrate existing ContextualMenu code to react-next May 13, 2020
import { IComponentAs } from 'office-ui-fabric-react/lib/Utilities';
import { IFocusZoneProps } from '@fluentui/react-focus';
import { IFocusZoneProps } from 'office-ui-fabric-react/lib/FocusZone';
import { IFocusZoneProps as IFocusZoneProps_2 } from '@fluentui/react-focus';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you fix this to avoid exporting things twice? (same with IIconProps)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I brought up the underlying issue in this comment

@dzearing @ecraig12345 Not sure of the advice concerning this build error:

@fluentui/react-next: [8:02:30 PM] x src/index.ts:18:1 - error TS2308: Module './Calendar' >has already exported a member named 'DateRangeType'. Consider explicitly re-exporting to >resolve the ambiguity.
@fluentui/react-next: 18 export * from './DatePicker';

Basically, since certain types are being re-exported from multiple components, and those types are now technically different when they're from different source files (OUFR vs react-next), we get this error.

Should we just copy OUFR over to react-next wholesale?

My question remains. I can't simply fix the duplication without either

  • copying over a substantial portion (for this error) or all (for all similar errors) of OUFR over to react-next, or
  • breaking existing export chains.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to what I responded on the other PR, I think the right thing to do for now is manually fixing up any duplicates (modifying import paths and removing duplicate exports as needed).

@ecraig12345 ecraig12345 reopened this May 13, 2020
@joschect
Copy link
Contributor

@MLoughry There were some changes to focus in popup and I cleaned up the focus tests in callout. I suspect that there might be some kind of pollution regarding focus when the tests were run. Especially if something like button was added to the page but never removed. I'll see if I can get some time to revamp the contextualmenu tests as well.

@MLoughry MLoughry requested a review from khmakoto as a code owner May 18, 2020 17:24
@ecraig12345
Copy link
Member

Thanks for the updates! Looks like it's failing now due to missing snapshot updates.

@MLoughry
Copy link
Contributor Author

@ecraig12345 Those are the failing focus tests I referenced earlier. My understanding from @joschect's comment was that he was going to investigate and clean them up.

@MLoughry
Copy link
Contributor Author

MLoughry commented Jun 8, 2020

@joschect Were you going to look into the focus issues?

Copy link
Member

@khmakoto khmakoto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with comments.

@@ -11,7 +11,7 @@ import { ContextualMenu } from './ContextualMenu';
import { canAnyMenuItemsCheck } from './ContextualMenu.base';
import { IContextualMenuItem, ContextualMenuItemType } from './ContextualMenu.types';
import { IContextualMenuRenderItem, IContextualMenuItemStyles } from './ContextualMenuItem.types';
import { DefaultButton, IButton } from '@fluentui/react-next/lib/Button';
import { DefaultButton, IButton } from '@fluentui/react-next/lib/compat/Button';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { DefaultButton, IButton } from '@fluentui/react-next/lib/compat/Button';
import { DefaultButton, IButton } from '../../compat/Button';

@@ -4,7 +4,7 @@ import { IFocusZoneProps } from '../../FocusZone';
import { IIconProps } from '@fluentui/react-next/lib/Icon';
import { ICalloutProps, ICalloutContentStyleProps, Target } from '../../Callout';
import { ITheme, IStyle } from '../../Styling';
import { IButtonStyles } from '../../Button';
import { IButtonStyles } from '@fluentui/react-next/lib/compat/Button';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { IButtonStyles } from '@fluentui/react-next/lib/compat/Button';
import { IButtonStyles } from '../../compat/Button';

@@ -3,7 +3,7 @@ import { IContextualMenuItem } from './ContextualMenu.types';
import { IMenuItemClassNames } from './ContextualMenu.classNames';
import { IStyle, ITheme } from '../../Styling';
import { IRefObject, IStyleFunctionOrObject } from '../../Utilities';
import { IButtonStyles } from '../../Button';
import { IButtonStyles } from '@fluentui/react-next/lib/compat/Button';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { IButtonStyles } from '@fluentui/react-next/lib/compat/Button';
import { IButtonStyles } from '../../compat/Button';

@@ -1,11 +1,10 @@
import * as React from 'react';
import { Position } from 'office-ui-fabric-react/lib/utilities/positioning';
import { IButtonStyles } from '@fluentui/react-next/lib/compat/Button';
import { IButtonStyles, IButtonProps } from '@fluentui/react-next/lib/compat/Button';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { IButtonStyles, IButtonProps } from '@fluentui/react-next/lib/compat/Button';
import { IButtonStyles, IButtonProps } from '../../compat/Button';

@@ -1,7 +1,7 @@
import * as React from 'react';
import { DirectionalHint } from '../../common/DirectionalHint';
import { IFocusZoneProps } from '../../FocusZone';
import { IIconProps } from 'office-ui-fabric-react/lib/Icon';
import { IIconProps } from '@fluentui/react-next/lib/Icon';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { IIconProps } from '@fluentui/react-next/lib/Icon';
import { IIconProps } from '../../Icon';

@@ -15,6 +15,7 @@ import {
IContextualMenuItemStyleProps,
} from './ContextualMenuItem.types';
import { IKeytipProps } from '../../Keytip';
import { ICalloutContentStyles } from 'office-ui-fabric-react';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this import as part of the imports in line 5.

aria-describedby={mergeAriaAttributeValues(item.ariaDescription, keytipAttributes['aria-describedby'])}
aria-checked={item.isChecked || item.checked}
aria-describedby={mergeAriaAttributeValues(
item.ariaDescription as string,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this cast needed?

item.ariaDescription as string,
keytipAttributes['aria-describedby'],
)}
aria-checked={(item.isChecked as boolean) || item.checked}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with this cast here.

@MLoughry MLoughry closed this Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants