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

fix(Tooltip): don't add aria-labelled by if aria-label is passed to Tooltip or trigger #12555

Merged
merged 9 commits into from
Apr 7, 2020
Merged

fix(Tooltip): don't add aria-labelled by if aria-label is passed to Tooltip or trigger #12555

merged 9 commits into from
Apr 7, 2020

Conversation

silviuaavram
Copy link
Contributor

@silviuaavram silviuaavram commented Apr 6, 2020

Pull request checklist

  • Addresses an existing issue: Fixes #0000
  • Include a change request file using $ yarn change

Description of changes

Checks for aria-labelled in either the root props or trigger props. If found in any, will not add aria-labelledby on trigger.

Focus areas to test

(optional)

Microsoft Reviewers: Open in CodeFlow

@size-auditor
Copy link

size-auditor bot commented Apr 6, 2020

Asset size changes

Size Auditor did not detect a change in bundle size for any component!

Baseline commit: 2c98aa23ebc33ac6005ce2eaff949f8eb27b16a0 (build)

@msft-github-bot
Copy link
Contributor

msft-github-bot commented Apr 6, 2020

Perf Analysis

No significant results to display.

All results

Scenario Master Ticks PR Ticks Iterations Status
BaseButton 871 919 5000
Checkbox 1884 1922 5000
CheckboxBase 1539 1570 5000
ChoiceGroup 5486 5594 5000
CommandBar 11346 11128 1000
DefaultButton 1119 1105 5000
DetailsRow 3504 3573 5000
DetailsRow (fast icons) 3446 3571 5000
DetailsRow without styles 3280 3285 5000
Dialog 7520 7448 5000
DocumentCardTitle with truncation 1586 1549 1000
Dropdown 3107 3107 5000
FocusZone 1602 1595 5000
IconButton 1734 1804 5000
Label 539 529 5000
Link 463 458 5000
MenuButton 1470 1447 5000
Nav 5553 5662 1000
Pivot 1359 1337 1000
PrimaryButton 1219 1257 5000
SearchBox 1490 1581 5000
Slider 1919 1910 5000
Spinner 375 404 5000
SplitButton 3065 3147 5000
Stack 461 489 5000
Stack with Intrinsic children 1107 1074 5000
Stack with Text children 4314 4161 5000
Text 384 392 5000
TextField 1838 1783 5000
Toggle 925 910 5000
button 61 63 5000

Perf Analysis (Fluent)

Perf comparison
Status Scenario Fluent TPI Fabric TPI Ratio Iterations Ticks
🔧 Avatar.Fluent 0.59 0.5 1.18:1 2000 1181
🦄 Button.Fluent 0.12 0.2 0.6:1 5000 581
🔧 Checkbox.Fluent 0.74 0.4 1.85:1 1000 736
🔧 Dialog.Fluent 0.4 0.2 2:1 5000 2023
🔧 Dropdown.Fluent 3.59 0.5 7.18:1 1000 3589
🔧 Icon.Fluent 0.17 0.05 3.4:1 5000 862
🎯 Image.Fluent 0.08 0.1 0.8:1 5000 404
🔧 Slider.Fluent 1.55 0.43 3.6:1 1000 1552
🔧 Text.Fluent 0.09 0.02 4.5:1 5000 452
🦄 Tooltip.Fluent 0.12 16.34 0.01:1 5000 581

🔧 Needs work     🎯 On target     🦄 Amazing

Perf tests with no regressions
Scenario Current PR Ticks Baseline Ticks Ratio
AttachmentMinimalPerf.default 181 156 1.16:1
TreeWith60ListItems.default 262 232 1.13:1
AnimationMinimalPerf.default 763 693 1.1:1
ListMinimalPerf.default 554 505 1.1:1
CardMinimalPerf.default 438 403 1.09:1
DividerMinimalPerf.default 1110 1046 1.06:1
ButtonMinimalPerf.default 163 155 1.05:1
RadioGroupMinimalPerf.default 629 598 1.05:1
CarouselMinimalPerf.default 680 654 1.04:1
ImageMinimalPerf.default 419 404 1.04:1
ListCommonPerf.default 1149 1106 1.04:1
PortalMinimalPerf.default 327 313 1.04:1
TreeMinimalPerf.default 1363 1307 1.04:1
Avatar.Fluent 1181 1138 1.04:1
Button.Fluent 581 557 1.04:1
ButtonSlotsPerf.default 696 675 1.03:1
DropdownManyItemsPerf.default 1521 1473 1.03:1
MenuButtonMinimalPerf.default 1751 1696 1.03:1
Icon.Fluent 862 839 1.03:1
AvatarMinimalPerf.default 594 582 1.02:1
ChatWithPopoverPerf.default 625 614 1.02:1
HeaderMinimalPerf.default 597 583 1.02:1
LoaderMinimalPerf.default 1080 1059 1.02:1
ReactionMinimalPerf.default 2529 2483 1.02:1
StatusMinimalPerf.default 763 751 1.02:1
TextMinimalPerf.default 465 454 1.02:1
ToolbarMinimalPerf.default 1248 1218 1.02:1
Image.Fluent 404 395 1.02:1
BoxMinimalPerf.default 420 417 1.01:1
ChatMinimalPerf.default 664 660 1.01:1
CheckboxMinimalPerf.default 3275 3256 1.01:1
FlexMinimalPerf.default 339 335 1.01:1
ListNestedPerf.default 1072 1066 1.01:1
ProviderMinimalPerf.default 617 610 1.01:1
IconMinimalPerf.default 830 818 1.01:1
TextAreaMinimalPerf.default 3227 3204 1.01:1
TooltipMinimalPerf.default 894 886 1.01:1
Dropdown.Fluent 3589 3538 1.01:1
EmbedMinimalPerf.default 5544 5530 1:1
ItemLayoutMinimalPerf.default 2215 2223 1:1
LabelMinimalPerf.default 429 427 1:1
ListWith60ListItems.default 1341 1347 1:1
MenuMinimalPerf.default 2098 2098 1:1
SplitButtonMinimalPerf.default 3843 3836 1:1
VideoMinimalPerf.default 989 988 1:1
Checkbox.Fluent 736 735 1:1
AttachmentSlotsPerf.default 2624 2662 0.99:1
HierarchicalTreeMinimalPerf.default 1151 1161 0.99:1
LayoutMinimalPerf.default 750 756 0.99:1
ProviderMergeThemesPerf.default 1390 1410 0.99:1
TableMinimalPerf.default 776 787 0.99:1
Slider.Fluent 1552 1573 0.99:1
Text.Fluent 452 458 0.99:1
AlertMinimalPerf.default 631 641 0.98:1
FormMinimalPerf.default 1026 1050 0.98:1
PopupMinimalPerf.default 244 248 0.98:1
CustomToolbarPrototype.default 3657 3715 0.98:1
Tooltip.Fluent 581 593 0.98:1
RefMinimalPerf.default 185 191 0.97:1
SegmentMinimalPerf.default 1224 1266 0.97:1
SliderMinimalPerf.default 1532 1579 0.97:1
ChatDuplicateMessagesPerf.default 423 441 0.96:1
GridMinimalPerf.default 908 941 0.96:1
HeaderSlotsPerf.default 1807 1885 0.96:1
Dialog.Fluent 2023 2128 0.95:1
DialogMinimalPerf.default 2033 2170 0.94:1
DropdownMinimalPerf.default 3549 3783 0.94:1
InputMinimalPerf.default 1030 1093 0.94:1
AccordionMinimalPerf.default 247 272 0.91:1

Copy link
Contributor

@kolaps33 kolaps33 left a comment

Choose a reason for hiding this comment

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

image

not sure if is it expected that "data-aa-class" has value "Undefined__trigger". Especially 'Undefined', it looks suspicious. If it is ok, take the comment as not relevant :)

@@ -10,30 +14,21 @@ import tooltipAsDescriptionBehavior, { TooltipBehaviorProps } from './tooltipAsD
*/
const tooltipAsLabelBehavior: Accessibility<TooltipBehaviorProps> = props => {
const behaviorData = tooltipAsDescriptionBehavior(props);
const defaultAriaLabeledBy = getDefaultAriaLabelledBy(props);
const triggerAriaLabel = props.triggerAriaLabel || props['aria-label'];
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure here if should we take into the "triggerAriaLabel" the "aria-label" prop which comes from Tooltip ?

When I tried to simulate, then "aria-label" which was set on the Tooltip is set on the trigger button. (of course different question is why would someone set aria-label on the Tooltip)
image

Copy link
Contributor

Choose a reason for hiding this comment

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

if there is a aria-label on the tooltip, it should just stay on the tooltip and should not be applied on the trigger I think

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 am now considering aria-label from trigger when I am conditionally applying aria-labelledby.

As for that classname, I fixed it by removing the classname and using another selector in the test. should be fine now

<Ref innerRef={triggerRef}>{React.cloneElement(triggerElement, getA11Props('trigger', triggerProps))}</Ref>
<Ref innerRef={triggerRef}>
{React.cloneElement(triggerElement, {
className: Tooltip.slotClassNames.trigger,
Copy link
Member

Choose a reason for hiding this comment

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

Let's avoid doing this as it will silently override existing className on a trigger

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So what do you suggest? Doing a cx composition of classes for that? I need to get that triggerElement in tests so I need the slot class.

Copy link
Member

Choose a reason for hiding this comment

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

cx can work, but in this case it should be done also in Popup. However, I don't like this option as trigger is not a real slot.

If it's only for tests I don't see any blocker to use Button.className or use a specific classname on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed, using button class now.

@silviuaavram silviuaavram merged commit 0adf3c5 into microsoft:master Apr 7, 2020
@silviuaavram silviuaavram deleted the fix/tooltip-trigger-aria-label branch April 7, 2020 15:50
DuanShaolong pushed a commit to DuanShaolong/fluentui that referenced this pull request Apr 27, 2020
…rigger (microsoft#12555)

* include trigger aria-label to behavior props

* send trigger aria-label to behavior

* fix behavior to not add aria-labelledby

* add unit tests

* changelog

* do not consider Tooltip aria-label for this fix

* remove trigger slot classname

* change changelog message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fluent UI react-northstar (v0) Work related to Fluent UI V0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants