Skip to content

Shortcircuit if Tooltip message and richMessage are empty#182524

Merged
auto-submit[bot] merged 3 commits into
masterfrom
tooltip-box
Feb 21, 2026
Merged

Shortcircuit if Tooltip message and richMessage are empty#182524
auto-submit[bot] merged 3 commits into
masterfrom
tooltip-box

Conversation

@victorsanni

Copy link
Copy Markdown
Contributor

Regressed when migrating to RawTooltip.

The unit tests added in #87638 to prevent this from happening were faulty, I've updated them to reflect this feature.

Fixes [flutter 3.41.x] NavigationDestination shows empty tooltip

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Feb 18, 2026

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request addresses a regression where an empty tooltip was being displayed. The fix involves short-circuiting the build method in TooltipState if the tooltip message is empty, which correctly prevents the creation of an unnecessary overlay. A new private getter _tooltipMessage has been introduced to centralize the logic for retrieving the tooltip's text content, which improves code clarity and maintainability. Additionally, the accompanying unit tests have been updated to accurately reflect and verify this behavior, correcting previously faulty tests. The changes are well-implemented and effectively resolve the issue.

@dkwingsmt dkwingsmt 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

@navaronbracke navaronbracke 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, with nit.

/// The plain text message for this tooltip.
///
/// This value will either come from [widget.message] or [widget.richMessage].
String get _tooltipMessage => widget.message ?? widget.richMessage!.toPlainText();

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.

The original code used the empty string if rich message was null?

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.

If richMessage is just a widget span, this may be shortcircuited as well. Is this the existing behavior before the change?

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.

Yes, this is existing behavior before RawTooltip.

@github-actions github-actions Bot added the a: tests "flutter test", flutter_test, or one of our tests label Feb 19, 2026
@victorsanni victorsanni added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 20, 2026
@auto-submit auto-submit Bot added this pull request to the merge queue Feb 20, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Feb 21, 2026
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Feb 21, 2026
@victorsanni victorsanni added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 21, 2026
@auto-submit auto-submit Bot added this pull request to the merge queue Feb 21, 2026
Merged via the queue into master with commit e6e3696 Feb 21, 2026
81 checks passed
@auto-submit auto-submit Bot deleted the tooltip-box branch February 21, 2026 06:20
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Feb 21, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Feb 23, 2026
flutter/flutter@91b2d41...dad6f9d

2026-02-23 engine-flutter-autoroll@skia.org Roll Packages from 9da22bf to 12b43a1 (19 revisions) (flutter/flutter#182758)
2026-02-23 engine-flutter-autoroll@skia.org Roll Skia from 55fae1660572 to 9a5a3c92c336 (7 revisions) (flutter/flutter#182749)
2026-02-23 engine-flutter-autoroll@skia.org Roll Skia from 256e2b47b303 to 55fae1660572 (1 revision) (flutter/flutter#182741)
2026-02-22 engine-flutter-autoroll@skia.org Roll Skia from 141ed451f007 to 256e2b47b303 (1 revision) (flutter/flutter#182732)
2026-02-22 engine-flutter-autoroll@skia.org Roll Skia from e59de8a12e7e to 141ed451f007 (1 revision) (flutter/flutter#182729)
2026-02-22 engine-flutter-autoroll@skia.org Roll Skia from f6ea7ef42d14 to e59de8a12e7e (1 revision) (flutter/flutter#182726)
2026-02-22 engine-flutter-autoroll@skia.org Roll Skia from 34fa7b2373f3 to f6ea7ef42d14 (1 revision) (flutter/flutter#182721)
2026-02-21 engine-flutter-autoroll@skia.org Roll Skia from 3ca547c8b816 to 34fa7b2373f3 (2 revisions) (flutter/flutter#182711)
2026-02-21 engine-flutter-autoroll@skia.org Roll Skia from c91ad88e89f8 to 3ca547c8b816 (9 revisions) (flutter/flutter#182696)
2026-02-21 victorsanniay@gmail.com Shortcircuit if Tooltip message and richMessage are empty (flutter/flutter#182524)
2026-02-21 50643541+Mairramer@users.noreply.github.com Add fields getter to FormState (flutter/flutter#180815)
2026-02-20 1961493+harryterkelsen@users.noreply.github.com fix(web_ui): use static whitelist for image codec tests (flutter/flutter#182648)
2026-02-20 victorsanniay@gmail.com Add cupertino docimports for CupertinoPageTransitionsBuilder and fix typos (flutter/flutter#182685)
2026-02-20 katelovett@google.com Fix Chat invite link (flutter/flutter#182675)
2026-02-20 engine-flutter-autoroll@skia.org Roll Skia from ce5854495a3a to c91ad88e89f8 (58 revisions) (flutter/flutter#182678)
2026-02-20 30870216+gaaclarke@users.noreply.github.com Manual dart sdk flutter 174bcc79 25ff 4267 8e26 d0e902f18681 1771486449 (flutter/flutter#182624)
2026-02-20 97480502+b-luk@users.noreply.github.com Don't compile shaders to SkSL unless --sksl arg is present (flutter/flutter#182519)
2026-02-20 katelovett@google.com Correct PerformanceOverlay optionsMask checks and add tests (flutter/flutter#182309)
2026-02-20 jason-simmons@users.noreply.github.com [Impeller] libImpeller: Dispose thread local caches on each Vulkan frame (flutter/flutter#182402)
2026-02-20 31859944+LongCatIsLooong@users.noreply.github.com Update CHANGELOG for 3.41.2 stable hotfix (flutter/flutter#182647)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC louisehsu@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
ahmedsameha1 pushed a commit to ahmedsameha1/flutter that referenced this pull request Feb 27, 2026
…2524)

Regressed when migrating to `RawTooltip`. 

The unit tests added in flutter#87638 to
prevent this from happening were faulty, I've updated them to reflect
this feature.

Fixes [[flutter 3.41.x] NavigationDestination shows empty
tooltip](flutter#182495)
okorohelijah pushed a commit to okorohelijah/packages that referenced this pull request Mar 26, 2026
…r#11102)

flutter/flutter@91b2d41...dad6f9d

2026-02-23 engine-flutter-autoroll@skia.org Roll Packages from 9da22bf to 12b43a1 (19 revisions) (flutter/flutter#182758)
2026-02-23 engine-flutter-autoroll@skia.org Roll Skia from 55fae1660572 to 9a5a3c92c336 (7 revisions) (flutter/flutter#182749)
2026-02-23 engine-flutter-autoroll@skia.org Roll Skia from 256e2b47b303 to 55fae1660572 (1 revision) (flutter/flutter#182741)
2026-02-22 engine-flutter-autoroll@skia.org Roll Skia from 141ed451f007 to 256e2b47b303 (1 revision) (flutter/flutter#182732)
2026-02-22 engine-flutter-autoroll@skia.org Roll Skia from e59de8a12e7e to 141ed451f007 (1 revision) (flutter/flutter#182729)
2026-02-22 engine-flutter-autoroll@skia.org Roll Skia from f6ea7ef42d14 to e59de8a12e7e (1 revision) (flutter/flutter#182726)
2026-02-22 engine-flutter-autoroll@skia.org Roll Skia from 34fa7b2373f3 to f6ea7ef42d14 (1 revision) (flutter/flutter#182721)
2026-02-21 engine-flutter-autoroll@skia.org Roll Skia from 3ca547c8b816 to 34fa7b2373f3 (2 revisions) (flutter/flutter#182711)
2026-02-21 engine-flutter-autoroll@skia.org Roll Skia from c91ad88e89f8 to 3ca547c8b816 (9 revisions) (flutter/flutter#182696)
2026-02-21 victorsanniay@gmail.com Shortcircuit if Tooltip message and richMessage are empty (flutter/flutter#182524)
2026-02-21 50643541+Mairramer@users.noreply.github.com Add fields getter to FormState (flutter/flutter#180815)
2026-02-20 1961493+harryterkelsen@users.noreply.github.com fix(web_ui): use static whitelist for image codec tests (flutter/flutter#182648)
2026-02-20 victorsanniay@gmail.com Add cupertino docimports for CupertinoPageTransitionsBuilder and fix typos (flutter/flutter#182685)
2026-02-20 katelovett@google.com Fix Chat invite link (flutter/flutter#182675)
2026-02-20 engine-flutter-autoroll@skia.org Roll Skia from ce5854495a3a to c91ad88e89f8 (58 revisions) (flutter/flutter#182678)
2026-02-20 30870216+gaaclarke@users.noreply.github.com Manual dart sdk flutter 174bcc79 25ff 4267 8e26 d0e902f18681 1771486449 (flutter/flutter#182624)
2026-02-20 97480502+b-luk@users.noreply.github.com Don't compile shaders to SkSL unless --sksl arg is present (flutter/flutter#182519)
2026-02-20 katelovett@google.com Correct PerformanceOverlay optionsMask checks and add tests (flutter/flutter#182309)
2026-02-20 jason-simmons@users.noreply.github.com [Impeller] libImpeller: Dispose thread local caches on each Vulkan frame (flutter/flutter#182402)
2026-02-20 31859944+LongCatIsLooong@users.noreply.github.com Update CHANGELOG for 3.41.2 stable hotfix (flutter/flutter#182647)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC louisehsu@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
mboetger pushed a commit to mboetger/flutter that referenced this pull request Mar 26, 2026
…2524)

Regressed when migrating to `RawTooltip`. 

The unit tests added in flutter#87638 to
prevent this from happening were faulty, I've updated them to reflect
this feature.

Fixes [[flutter 3.41.x] NavigationDestination shows empty
tooltip](flutter#182495)
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
…r#11102)

flutter/flutter@91b2d41...dad6f9d

2026-02-23 engine-flutter-autoroll@skia.org Roll Packages from 9da22bf to 12b43a1 (19 revisions) (flutter/flutter#182758)
2026-02-23 engine-flutter-autoroll@skia.org Roll Skia from 55fae1660572 to 9a5a3c92c336 (7 revisions) (flutter/flutter#182749)
2026-02-23 engine-flutter-autoroll@skia.org Roll Skia from 256e2b47b303 to 55fae1660572 (1 revision) (flutter/flutter#182741)
2026-02-22 engine-flutter-autoroll@skia.org Roll Skia from 141ed451f007 to 256e2b47b303 (1 revision) (flutter/flutter#182732)
2026-02-22 engine-flutter-autoroll@skia.org Roll Skia from e59de8a12e7e to 141ed451f007 (1 revision) (flutter/flutter#182729)
2026-02-22 engine-flutter-autoroll@skia.org Roll Skia from f6ea7ef42d14 to e59de8a12e7e (1 revision) (flutter/flutter#182726)
2026-02-22 engine-flutter-autoroll@skia.org Roll Skia from 34fa7b2373f3 to f6ea7ef42d14 (1 revision) (flutter/flutter#182721)
2026-02-21 engine-flutter-autoroll@skia.org Roll Skia from 3ca547c8b816 to 34fa7b2373f3 (2 revisions) (flutter/flutter#182711)
2026-02-21 engine-flutter-autoroll@skia.org Roll Skia from c91ad88e89f8 to 3ca547c8b816 (9 revisions) (flutter/flutter#182696)
2026-02-21 victorsanniay@gmail.com Shortcircuit if Tooltip message and richMessage are empty (flutter/flutter#182524)
2026-02-21 50643541+Mairramer@users.noreply.github.com Add fields getter to FormState (flutter/flutter#180815)
2026-02-20 1961493+harryterkelsen@users.noreply.github.com fix(web_ui): use static whitelist for image codec tests (flutter/flutter#182648)
2026-02-20 victorsanniay@gmail.com Add cupertino docimports for CupertinoPageTransitionsBuilder and fix typos (flutter/flutter#182685)
2026-02-20 katelovett@google.com Fix Chat invite link (flutter/flutter#182675)
2026-02-20 engine-flutter-autoroll@skia.org Roll Skia from ce5854495a3a to c91ad88e89f8 (58 revisions) (flutter/flutter#182678)
2026-02-20 30870216+gaaclarke@users.noreply.github.com Manual dart sdk flutter 174bcc79 25ff 4267 8e26 d0e902f18681 1771486449 (flutter/flutter#182624)
2026-02-20 97480502+b-luk@users.noreply.github.com Don't compile shaders to SkSL unless --sksl arg is present (flutter/flutter#182519)
2026-02-20 katelovett@google.com Correct PerformanceOverlay optionsMask checks and add tests (flutter/flutter#182309)
2026-02-20 jason-simmons@users.noreply.github.com [Impeller] libImpeller: Dispose thread local caches on each Vulkan frame (flutter/flutter#182402)
2026-02-20 31859944+LongCatIsLooong@users.noreply.github.com Update CHANGELOG for 3.41.2 stable hotfix (flutter/flutter#182647)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC louisehsu@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: tests "flutter test", flutter_test, or one of our tests f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[flutter 3.41.x] NavigationDestination shows empty tooltip

4 participants