Skip to content

Fix: Delay showing tooltip during page transition - #167614

Merged
auto-submit[bot] merged 1 commit into
flutter:masterfrom
rkishan516:tooltip-transition
Apr 30, 2025
Merged

auto-submit[bot] merged 1 commit into
flutter:masterfrom
rkishan516:tooltip-transition

Conversation

@rkishan516

Copy link
Copy Markdown
Contributor

Fix: Delay showing tooltip during page transition
fixes: #167359

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • All existing and new tests are passing.

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages labels Apr 23, 2025
final ModalRoute<dynamic>? route = ModalRoute.of(context);
if (route?.secondaryAnimation != null && route!.secondaryAnimation!.isAnimating) {
_timer?.cancel();
_timer = Timer(route.transitionDuration, show);

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.

Is it possible to listen to when the animation ends and start the timer then? The current way isn't compatible with cases where this happens halfway during the transition or simulation-based transition where there isn't a predefined duration.

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.

Yaa, was thinking the same. but for some reason below written code doesn't fix the issue.

if (route?.secondaryAnimation != null && route!.secondaryAnimation!.isAnimating) {
   _timer?.cancel();
   void onAnimationDismiss(AnimationStatus status) {
        if (status == AnimationStatus.dismissed) {
           route.secondaryAnimation!.removeStatusListener(onAnimationDismiss);
           show();
       }
   }

    route.secondaryAnimation!.addStatusListener(onAnimationDismiss);
    return;
}

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.

In some cases the secondaryAnimation is swapped for a different one, so that may be why. The secondaryAnimation with the status listener is replaced.

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.

Rather than putting the logic here, should we have the check happen in tandem with the _visible check for _ExclusiveMouseRegion? So it ignores all mouse events while the route transitions are in motion?

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.

Oh yes, that will be better place and we don't even need listener.

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.

Pushed the change, everything looks good. Thanks.

@rkishan516
rkishan516 force-pushed the tooltip-transition branch 4 times, most recently from 4ef9c09 to 0617cf1 Compare April 25, 2025 01:51

@MitchellGoodwin MitchellGoodwin left a comment

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.

LGTM! Thank you for making this fix. Just left one tiny nit.

expect(tester.element(textAncestors.first).size, equals(tooltipConstraints.biggest));
});

testWidgets('Tooltip does not show while transitioning from another page', (

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.

Extreme nit, for this case I think it needs a link to the issue it is checking against.

Suggested change
testWidgets('Tooltip does not show while transitioning from another page', (
// This is a regression test for https://github.com/flutter/flutter/issues/167359.
testWidgets('Tooltip does not show while transitioning from another page', (

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.

Thanks for suggestion. Pushed the change.

@Piinks Piinks left a comment

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.

LGTM, thank you!

@Piinks Piinks added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 30, 2025
@auto-submit
auto-submit Bot added this pull request to the merge queue Apr 30, 2025
Merged via the queue into flutter:master with commit fb18bb4 Apr 30, 2025
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 30, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 7, 2025
@gnprice gnprice mentioned this pull request May 20, 2025
8 of 9 tasks
github-merge-queue Bot pushed a commit that referenced this pull request Aug 8, 2025
Makes the tooltip interactive if the route is the current route and the
route is not animating out.

Added `_route` to cache `ModalRoute.of(context)`.

Consolidates [Fix the issue with
Tooltip](#168546) and [Delay
showing tooltip during page
transition](#167614)

Fix [[Desktop] [Web] [Regression] [3.32] AppBar back - RenderBox was not
laid out -
TooltipState._buildTooltipOverlay](#169741)
SydneyBao pushed a commit to SydneyBao/flutter that referenced this pull request Aug 11, 2025
Makes the tooltip interactive if the route is the current route and the
route is not animating out.

Added `_route` to cache `ModalRoute.of(context)`.

Consolidates [Fix the issue with
Tooltip](flutter#168546) and [Delay
showing tooltip during page
transition](flutter#167614)

Fix [[Desktop] [Web] [Regression] [3.32] AppBar back - RenderBox was not
laid out -
TooltipState._buildTooltipOverlay](flutter#169741)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
romanejaquez pushed a commit to romanejaquez/flutter that referenced this pull request Aug 14, 2025
Fix: Delay showing tooltip during page transition
fixes: flutter#167359 

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2025
ksokolovskyi pushed a commit to ksokolovskyi/flutter that referenced this pull request Aug 19, 2025
Makes the tooltip interactive if the route is the current route and the
route is not animating out.

Added `_route` to cache `ModalRoute.of(context)`.

Consolidates [Fix the issue with
Tooltip](flutter#168546) and [Delay
showing tooltip during page
transition](flutter#167614)

Fix [[Desktop] [Web] [Regression] [3.32] AppBar back - RenderBox was not
laid out -
TooltipState._buildTooltipOverlay](flutter#169741)
mboetger pushed a commit to mboetger/flutter that referenced this pull request Sep 18, 2025
Makes the tooltip interactive if the route is the current route and the
route is not animating out.

Added `_route` to cache `ModalRoute.of(context)`.

Consolidates [Fix the issue with
Tooltip](flutter#168546) and [Delay
showing tooltip during page
transition](flutter#167614)

Fix [[Desktop] [Web] [Regression] [3.32] AppBar back - RenderBox was not
laid out -
TooltipState._buildTooltipOverlay](flutter#169741)
korca0220 pushed a commit to korca0220/flutter that referenced this pull request Sep 22, 2025
Makes the tooltip interactive if the route is the current route and the
route is not animating out.

Added `_route` to cache `ModalRoute.of(context)`.

Consolidates [Fix the issue with
Tooltip](flutter#168546) and [Delay
showing tooltip during page
transition](flutter#167614)

Fix [[Desktop] [Web] [Regression] [3.32] AppBar back - RenderBox was not
laid out -
TooltipState._buildTooltipOverlay](flutter#169741)
lucaantonelli pushed a commit to lucaantonelli/flutter that referenced this pull request Nov 21, 2025
Makes the tooltip interactive if the route is the current route and the
route is not animating out.

Added `_route` to cache `ModalRoute.of(context)`.

Consolidates [Fix the issue with
Tooltip](flutter#168546) and [Delay
showing tooltip during page
transition](flutter#167614)

Fix [[Desktop] [Web] [Regression] [3.32] AppBar back - RenderBox was not
laid out -
TooltipState._buildTooltipOverlay](flutter#169741)
@rkishan516
rkishan516 deleted the tooltip-transition branch February 20, 2026 03:08
chunhtai pushed a commit to chunhtai/packages that referenced this pull request Jun 12, 2026
Makes the tooltip interactive if the route is the current route and the
route is not animating out.

Added `_route` to cache `ModalRoute.of(context)`.

Consolidates [Fix the issue with
Tooltip](flutter/flutter#168546) and [Delay
showing tooltip during page
transition](flutter/flutter#167614)

Fix [[Desktop] [Web] [Regression] [3.32] AppBar back - RenderBox was not
laid out -
TooltipState._buildTooltipOverlay](flutter/flutter#169741)
Nakiha pushed a commit to Nakiha/VoidPlayer-Flutter that referenced this pull request Sep 28, 2026
Makes the tooltip interactive if the route is the current route and the
route is not animating out.

Added `_route` to cache `ModalRoute.of(context)`.

Consolidates [Fix the issue with
Tooltip](flutter/flutter#168546) and [Delay
showing tooltip during page
transition](flutter/flutter#167614)

Fix [[Desktop] [Web] [Regression] [3.32] AppBar back - RenderBox was not
laid out -
TooltipState._buildTooltipOverlay](flutter/flutter#169741)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PopupMenuButton asserts when rendering tooltip after navigating back using Cupertino tab layout

4 participants