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: TooltipHost supports an accessible method to implement overflow tooltips #27653

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

smhigley
Copy link
Contributor

Previous Behavior

TooltipHost has an overflowMode feature that lets authors automatically show a tooltip with the specified element has text oveflow. The issue is that the element must be either:

  1. The TooltipHost root, which is not an interactive element. This only works if the text is a direct child of the TooltipHost, and not nested within a child interactive element
  2. The parent of the TooltipHost. Focusing or hover the parent does not actually trigger the tooltip though, only the overflow calculation.

Neither of those options support allowing a focusable semantic element to have an overflow tooltip that shows up on focus. All possible overflow tooltip options only supported hover.

New Behavior

TooltipHost now has a TooltipOverflowMode.Custom option, and a prop to pass in a ref to the element that should be used for overflow calculations. This allows authors to target a child interactive element, which then works to trigger a tooltip on keyboard focus.

The examples for overflowMode have also been updated, and the incorrect information about aria-describedby has been removed.

Related Issue(s)

This came up while trying to help a team implement a keyboard-accessible overflow tooltip on a link.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 21, 2023

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 738c2fd:

Sandbox Source
@fluentui/react 8 starter Configuration
@fluentui/react-components 9 starter Configuration

@size-auditor
Copy link

size-auditor bot commented Apr 21, 2023

Asset size changes

Project Bundle Baseline Size New Size Difference
office-ui-fabric-react fluentui-react-CommandBar 191.418 kB 191.499 kB ExceedsBaseline     81 bytes
office-ui-fabric-react fluentui-react-SelectedItemsList 220.976 kB 221.057 kB ExceedsBaseline     81 bytes
office-ui-fabric-react fluentui-react-ColorPicker 126.086 kB 126.167 kB ExceedsBaseline     81 bytes
office-ui-fabric-react fluentui-react-Facepile 200.245 kB 200.326 kB ExceedsBaseline     81 bytes
office-ui-fabric-react fluentui-react-FloatingPicker 230.532 kB 230.613 kB ExceedsBaseline     81 bytes
office-ui-fabric-react fluentui-react-Breadcrumb 190.387 kB 190.468 kB ExceedsBaseline     81 bytes
office-ui-fabric-react fluentui-react-Persona 108.305 kB 108.386 kB ExceedsBaseline     81 bytes
office-ui-fabric-react fluentui-react-Pickers 280.499 kB 280.58 kB ExceedsBaseline     81 bytes
office-ui-fabric-react fluentui-react-PersonaCoin 108.305 kB 108.386 kB ExceedsBaseline     81 bytes
office-ui-fabric-react fluentui-react-Tooltip 80.891 kB 80.972 kB ExceedsBaseline     81 bytes

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

Baseline commit: 46f19b90d2088f055f9cd4bfad840f72fe68f0d8 (build)

@fabricteam
Copy link
Collaborator

fabricteam commented Apr 21, 2023

📊 Bundle size report

🤖 This report was generated against 46f19b90d2088f055f9cd4bfad840f72fe68f0d8

@fabricteam
Copy link
Collaborator

fabricteam commented Apr 21, 2023

Perf Analysis (@fluentui/react)

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
BaseButton mount 780 792 5000
Breadcrumb mount 2077 2049 1000
Checkbox mount 2100 2097 5000
CheckboxBase mount 1846 1853 5000
ChoiceGroup mount 3486 3503 5000
ComboBox mount 786 798 1000
CommandBar mount 7757 7703 1000
ContextualMenu mount 13084 13721 1000
DefaultButton mount 944 932 5000
DetailsRow mount 2637 2635 5000
DetailsRowFast mount 2626 2622 5000
DetailsRowNoStyles mount 2456 2423 5000
Dialog mount 3222 3219 1000
DocumentCardTitle mount 287 292 1000
Dropdown mount 2445 2473 5000
FocusTrapZone mount 1397 1403 5000
FocusZone mount 1361 1363 5000
GroupedList mount 45369 45388 2
GroupedList virtual-rerender 22090 22110 2
GroupedList virtual-rerender-with-unmount 62353 62283 2
GroupedListV2 mount 292 284 2
GroupedListV2 virtual-rerender 265 263 2
GroupedListV2 virtual-rerender-with-unmount 286 289 2
IconButton mount 1318 1303 5000
Label mount 444 452 5000
Layer mount 3350 3386 5000
Link mount 521 525 5000
MenuButton mount 1169 1149 5000
MessageBar mount 25853 26301 5000
Nav mount 2362 2350 1000
OverflowSet mount 1028 1012 5000
Panel mount 2181 2168 1000
Persona mount 914 925 1000
Pivot mount 1058 1068 1000
PrimaryButton mount 1040 1039 5000
Rating mount 5767 5752 5000
SearchBox mount 1096 1126 5000
Shimmer mount 2371 2314 5000
Slider mount 1693 1685 5000
SpinButton mount 3391 3400 5000
Spinner mount 509 519 5000
SplitButton mount 2178 2158 5000
Stack mount 536 530 5000
StackWithIntrinsicChildren mount 1084 1071 5000
StackWithTextChildren mount 3363 3392 5000
SwatchColorPicker mount 7326 7348 5000
TagPicker mount 1708 1704 5000
Text mount 488 490 5000
TextField mount 1131 1118 5000
ThemeProvider mount 1014 1006 5000
ThemeProvider virtual-rerender 793 794 5000
ThemeProvider virtual-rerender-with-unmount 1571 1550 5000
Toggle mount 794 773 5000
buttonNative mount 244 248 5000

Copy link
Contributor

@sopranopillow sopranopillow left a comment

Choose a reason for hiding this comment

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

lgtm, just one minor comment

Co-authored-by: Esteban Munoz Facusse <[email protected]>
@@ -0,0 +1,7 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

🕵 fluentuiv8 Open the Visual Regressions report to inspect the 2 screenshots

✅ There was 0 screenshots added, 2 screenshots removed, 1045 screenshots unchanged, 0 screenshots with different dimensions and 0 screenshots with visible difference.

unknown 2 screenshots
Image Name Diff(in Pixels) Image Type
Pivot - Overflow.Root.Narrow - Last tab selected.chromium.png 0 Removed
Pivot - Overflow.Root.Narrow - Overflow menu.chromium.png 0 Removed

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.

5 participants