fix(react-tooltip): dismiss tooltip when document becomes hidden#36023
Open
fix(react-tooltip): dismiss tooltip when document becomes hidden#36023
Conversation
2 tasks
Agent-Logs-Url: https://github.com/microsoft/fluentui/sessions/f63f5a32-8d4d-4adc-8419-ab20ef41ac6f Co-authored-by: tudorpopams <97875118+tudorpopams@users.noreply.github.com>
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
📊 Bundle size reportUnchanged fixtures
|
|
Pull request demo site: URL |
| @@ -0,0 +1,7 @@ | |||
| { | |||
There was a problem hiding this comment.
🕵🏾♀️ 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.
tudorpopams
reviewed
Apr 23, 2026
| // 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 |
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
approved these changes
Apr 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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
pointerleavenorblurfires 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-gateduseIsomorphicLayoutEffect(which already owns thekeydown/Escape listener), register avisibilitychangelistener ontargetDocumentfromuseFluent_unstable(). WhentargetDocument.visibilityState === 'hidden', call the samethisTooltip.hide()path used by Escape soonVisibleChangeand controlled-state semantics are preserved. Cleanup is colocated with the existingkeydownremoval.Tooltip.test.tsx: New test stubsdocument.visibilityStateto'hidden', dispatches avisibilitychangeevent, and assertsonVisibleChangefires with{ visible: false }.@fluentui/react-tooltip.Caveat
The reported bug is on iOS Safari / Mobile Edge. The Jest test verifies the dismiss path fires on
visibilitychangein jsdom; the actual iOS task-switcher flow needs manual verification by the reviewer on a real device.