Skip to content

fix(react-tooltip): dismiss tooltip when document becomes hidden#36023

Open
Copilot wants to merge 5 commits intomasterfrom
copilot/fix-tooltip-persistence-mobile
Open

fix(react-tooltip): dismiss tooltip when document becomes hidden#36023
Copilot wants to merge 5 commits intomasterfrom
copilot/fix-tooltip-persistence-mobile

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 21, 2026

On mobile, tapping a tooltip-wrapped link that opens a new tab leaves the tooltip stuck visible after returning to the original tab, because neither pointerleave nor blur fires in that flow. Per WCAG 1.4.13 analysis in the issue thread, dismissing is correct here since the original hover/tap/focus trigger is no longer active.

Changes

  • useTooltipBase.tsx: Inside the existing visibility-gated useIsomorphicLayoutEffect (which already owns the keydown/Escape listener), register a visibilitychange listener on targetDocument from useFluent_unstable(). When targetDocument.visibilityState === 'hidden', call the same thisTooltip.hide() path used by Escape so onVisibleChange and controlled-state semantics are preserved. Cleanup is colocated with the existing keydown removal.
  • Tooltip.test.tsx: New test stubs document.visibilityState to 'hidden', dispatches a visibilitychange event, and asserts onVisibleChange fires with { visible: false }.
  • Change file: patch bump for @fluentui/react-tooltip.

Caveat

The reported bug is on iOS Safari / Mobile Edge. The Jest test verifies the dismiss path fires on visibilitychange in jsdom; the actual iOS task-switcher flow needs manual verification by the reviewer on a real device.

Copilot AI changed the title [WIP] Fix tooltip persistence on mobile touch devices after tab switch fix(react-tooltip): dismiss tooltip when document becomes hidden Apr 21, 2026
Copilot AI requested a review from tudorpopams April 21, 2026 20:28
@tudorpopams tudorpopams marked this pull request as ready for review April 22, 2026 07:29
@tudorpopams tudorpopams requested review from a team and mainframev as code owners April 22, 2026 07:29
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 22, 2026

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-charts
AreaChart
413.179 kB
126.715 kB
413.352 kB
126.756 kB
173 B
41 B
react-charts
DeclarativeChart
763.941 kB
220.708 kB
764.114 kB
220.748 kB
173 B
40 B
react-charts
DonutChart
323.598 kB
97.203 kB
323.771 kB
97.247 kB
173 B
44 B
react-charts
FunnelChart
315.145 kB
94.214 kB
315.318 kB
94.254 kB
173 B
40 B
react-charts
GanttChart
396.287 kB
120.229 kB
396.46 kB
120.273 kB
173 B
44 B
react-charts
GaugeChart
323.031 kB
96.624 kB
323.204 kB
96.667 kB
173 B
43 B
react-charts
GroupedVerticalBarChart
404.162 kB
122.801 kB
404.335 kB
122.847 kB
173 B
46 B
react-charts
HeatMapChart
398.359 kB
122.12 kB
398.532 kB
122.16 kB
173 B
40 B
react-charts
HorizontalBarChart
303.328 kB
89.375 kB
303.501 kB
89.417 kB
173 B
42 B
react-charts
LineChart
424.519 kB
128.787 kB
424.692 kB
128.834 kB
173 B
47 B
react-charts
SankeyChart
221.013 kB
68.074 kB
221.186 kB
68.129 kB
173 B
55 B
react-charts
ScatterChart
403.901 kB
122.916 kB
404.074 kB
122.96 kB
173 B
44 B
react-charts
VerticalBarChart
440.631 kB
128.396 kB
440.804 kB
128.444 kB
173 B
48 B
react-charts
VerticalStackedBarChart
410.173 kB
124.305 kB
410.346 kB
124.345 kB
173 B
40 B
react-components
react-components: entire library
1.302 MB
325.417 kB
1.302 MB
325.461 kB
173 B
44 B
react-tooltip
Tooltip
57.52 kB
19.808 kB
57.693 kB
19.847 kB
173 B
39 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-avatar
Avatar
48.492 kB
15.379 kB
react-avatar
AvatarGroup
17.525 kB
7.018 kB
react-avatar
AvatarGroupItem
61.88 kB
19.405 kB
react-charts
HorizontalBarChartWithAxis
63 B
83 B
react-charts
Legends
243.069 kB
71.827 kB
react-charts
PolarChart
352.167 kB
107.633 kB
react-charts
Sparkline
91.4 kB
28.708 kB
react-checkbox
Checkbox
33.718 kB
11.424 kB
react-combobox
Combobox (including child components)
106.891 kB
34.646 kB
react-combobox
Dropdown (including child components)
106.661 kB
34.384 kB
react-components
react-components: Button, FluentProvider & webLightTheme
70.415 kB
19.963 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
237.472 kB
68.929 kB
react-components
react-components: FluentProvider & webLightTheme
43.63 kB
14.026 kB
react-datepicker-compat
DatePicker Compat
225.645 kB
63.659 kB
react-dialog
Dialog (including children components)
102.176 kB
30.389 kB
react-field
Field
22.411 kB
8.393 kB
react-headless-components-preview
react-headless-components-preview: entire library
74.611 kB
21.728 kB
react-input
Input
26.298 kB
8.705 kB
react-list
List
87.155 kB
25.773 kB
react-list
ListItem
111.036 kB
32.683 kB
react-persona
Persona
55.447 kB
17.311 kB
react-portal-compat
PortalCompatProvider
8.386 kB
2.624 kB
react-progress
ProgressBar
20.23 kB
7.866 kB
react-radio
Radio
31.105 kB
9.66 kB
react-radio
RadioGroup
14.053 kB
5.703 kB
react-select
Select
26.183 kB
9.474 kB
react-slider
Slider
36.377 kB
12.034 kB
react-spinbutton
SpinButton
33.822 kB
11.128 kB
react-swatch-picker
@fluentui/react-swatch-picker - package
104.356 kB
29.956 kB
react-switch
Switch
36.351 kB
11.07 kB
react-table
DataGrid
159.836 kB
45.028 kB
react-table
Table (Primitives only)
41.015 kB
13.174 kB
react-table
Table as DataGrid
131.023 kB
36.014 kB
react-table
Table (Selection only)
69.409 kB
19.408 kB
react-table
Table (Sort only)
68.052 kB
19.026 kB
react-tag-picker
@fluentui/react-tag-picker - package
187.196 kB
55.98 kB
react-tags
InteractionTag
13.742 kB
5.473 kB
react-tags
Tag
29.666 kB
9.433 kB
react-tags
TagGroup
82.265 kB
24.156 kB
react-textarea
Textarea
24.686 kB
8.972 kB
react-timepicker-compat
TimePicker
109.856 kB
36.253 kB
react-tree
FlatTree
148.205 kB
42.256 kB
react-tree
PersonaFlatTree
150.033 kB
42.629 kB
react-tree
PersonaTree
146.093 kB
41.446 kB
react-tree
Tree
144.271 kB
41.075 kB
🤖 This report was generated against 13bcf75018ad4fa0b2f1b6e2de42d2cfcbdfaf6c

@github-actions
Copy link
Copy Markdown

Pull request demo site: URL

@@ -0,0 +1,7 @@
{
Copy link
Copy Markdown

@github-actions github-actions Bot Apr 22, 2026

Choose a reason for hiding this comment

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

🕵🏾‍♀️ visual changes to review in the Visual Change Report

vr-tests-react-components/Avatar Converged 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Avatar Converged.badgeMask - RTL.normal.chromium.png 5 Changed
vr-tests-react-components/Avatar Converged.badgeMask.normal.chromium.png 5 Changed
vr-tests-react-components/Charts-DonutChart 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Charts-DonutChart.Dynamic - Dark Mode.default.chromium.png 7530 Changed
vr-tests-react-components/Charts-DonutChart.Dynamic.default.chromium.png 5581 Changed
vr-tests-react-components/Menu Converged - submenuIndicator slotted content 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Menu Converged - submenuIndicator slotted content.default - RTL.submenus open.chromium.png 404 Changed
vr-tests-react-components/Positioning 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Positioning.Positioning end.chromium.png 28 Changed
vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png 601 Changed
vr-tests-react-components/ProgressBar converged 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/ProgressBar converged.Indeterminate + thickness - High Contrast.default.chromium.png 64 Changed
vr-tests-react-components/ProgressBar converged.Indeterminate + thickness.default.chromium.png 40 Changed
vr-tests-react-components/TagPicker 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/TagPicker.disabled.chromium.png 677 Changed

There were 1 duplicate changes discarded. Check the build logs for more information.

// Dismiss the tooltip when the document becomes hidden (e.g. tab backgrounded,
// app switched on mobile). The original trigger (hover/tap/focus) is no longer
// active in this case, so persisting the tooltip is a stale UI state.
// See https://github.com/microsoft/fluentui/issues/35301
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@copilot this link takes you to a React 19 related PR. Not relevant for this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed the incorrect issue link from the comment in 8b5f0e7.

Agent-Logs-Url: https://github.com/microsoft/fluentui/sessions/86e33d49-003c-4190-9a61-90a69bca5bc6

Co-authored-by: tudorpopams <97875118+tudorpopams@users.noreply.github.com>
@tudorpopams tudorpopams enabled auto-merge (squash) April 23, 2026 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Tooltip persists on mobile touch devices after returning from a link that opens in a new tab (A11y vs Touch behavior)

2 participants