Skip to content

Tooltips get in the way of hovering other widgets on web and desktop platforms. #142465

Closed

Description

@jezell

Steps to reproduce

Add a tooltip to a list of vertically stacked widgets which are 32x32 or about the size of the average desktop toolbar. Hover one of the items so that the tooltip shows up. Try to hover the item below, you won't be able to if your mouse lands on the tooltip because hovering the tooltip will keep the tooltip on screen.

Expected results

When tooltips are displayed by hovering, they should be wrapped in ignorePointer: true, or if there is a good reason not to do this always, there should be an option ignorePointer on the tooltip widget. Tooltips should not get in the way of hovering other widgets. Compare to tooltips in chrome or somewhere else. This is not usually how tooltips work and it currently makes them unusable on desktop when they overlap other widgets that might need to be hovered.

Actual results

Tooltips get in the way of hovering other widgets.

Code sample

n/a

Screenshots or Video

No response

Logs

No response

Flutter Doctor output

n/a

Activity

  1. darshankawar commented on Jan 30, 2024

    @darshankawar
    Member

    @jezell
    Can you try by passing showDuration: Duration.zero as mentioned in this issue and check if it helps to resolve your issue ?
    If not, can you provide us a runnable code sample that shows the current behavior you are seeing ?

  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jan 30, 2024
  3. jezell commented on Jan 30, 2024

    @jezell
    ContributorAuthor

    @darshankawar That doesn't work because the mouse can move to the tooltip before the zero duration check. Reproducable on dartpad with the code below. If you move your mouse on top of the tooltip, the tooltip will never go away:

    import 'package:flutter/material.dart';
    
    const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
    
    void main() {
      runApp(MyApp());
    }
    
    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          theme: ThemeData.dark().copyWith(
            scaffoldBackgroundColor: darkBlue,
          ),
          debugShowCheckedModeBanner: false,
          home: Scaffold(
            body: MyWidget(),
          ),
        );
      }
    }
    
    class MyWidget extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return Column(
          mainAxisSize: MainAxisSize.min,
          children: [ 
            
            Tooltip(showDuration: Duration.zero, message: "hi", child: Container(width: 32, height: 32, decoration: BoxDecoration(color: Colors.red, border: Border.all(color: Colors.black)))),
            Tooltip(showDuration: Duration.zero, message: "hi", child: Container(width: 32, height: 32, decoration: BoxDecoration(color: Colors.red, border: Border.all(color: Colors.black)))),
            Tooltip(showDuration: Duration.zero, message: "hi", child: Container(width: 32, height: 32, decoration: BoxDecoration(color: Colors.red, border: Border.all(color: Colors.black)))),
            Tooltip(showDuration: Duration.zero, message: "hi", child: Container(width: 32, height: 32, decoration: BoxDecoration(color: Colors.red, border: Border.all(color: Colors.black)))),
            ]);
      }
    }
    
  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jan 30, 2024
  5. changed the title [-]Tooltip should ignore pointer[/-] [+]Tooltips get in the way of hovering other widgets on web and desktop platforms.[/+] on Jan 31, 2024
  6. darshankawar commented on Jan 31, 2024

    @darshankawar
    Member

    Thanks for the feedback and reproducible code sample. The behavior is visible on web and desktop platforms as shown below:

    142465.mov
    stable, master flutter doctor -v
    [!] Flutter (Channel stable, 3.16.8, on macOS 12.2.1 21D62 darwin-x64, locale
        en-GB)
        • Flutter version 3.16.8 on channel stable at
          /Users/dhs/documents/fluttersdk/flutter
        ! Warning: `flutter` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside
          your current Flutter SDK checkout at
          /Users/dhs/documents/fluttersdk/flutter. Consider adding
          /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path.
        ! Warning: `dart` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your
          current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter.
          Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front
          of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 67457e669f (2 days ago), 2024-01-16 16:22:29 -0800
        • Engine revision 6e2ea58a5c
        • Dart version 3.2.5
        • DevTools version 2.28.5
        • If those were intentional, you can disregard the above warnings; however
          it is recommended to use "git" directly to perform update checks and
          upgrades.
    
    [!] Xcode - develop for iOS and macOS (Xcode 12.3)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        ! Flutter recommends a minimum Xcode version of 13.
          Download the latest version or update via the Mac App Store.
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] VS Code (version 1.62.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.21.0
    
    [✓] Connected device (5 available)
        • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
        • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
          ios            • iOS 14.4.1 18D61
        • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
          ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
        • macOS (desktop)            • macos                                    •
          darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
        • Chrome (web)               • chrome                                   •
          web-javascript • Google Chrome 98.0.4758.80
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
    
    [!] Flutter (Channel master, 3.19.0-14.0.pre.25, on macOS 12.2.1 21D62
        darwin-x64, locale en-GB)
        • Flutter version 3.19.0-14.0.pre.25 on channel master at
          /Users/dhs/documents/fluttersdk/flutter
        ! Warning: `flutter` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside
          your current Flutter SDK checkout at
          /Users/dhs/documents/fluttersdk/flutter. Consider adding
          /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path.
        ! Warning: `dart` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your
          current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter.
          Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front
          of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 4af2051f8e (61 minutes ago), 2024-01-30 23:13:30 -0500
        • Engine revision 2d2d88068a
        • Dart version 3.4.0 (build 3.4.0-92.0.dev)
        • DevTools version 2.31.0
        • If those were intentional, you can disregard the above warnings; however
          it is recommended to use "git" directly to perform update checks and
          upgrades.
    
    [!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
        • Android SDK at /Users/dhs/Library/Android/sdk
        ✗ cmdline-tools component is missing
          Run `path/to/sdkmanager --install "cmdline-tools;latest"`
          See https://developer.android.com/studio/command-line for more details.
        ✗ Android license status unknown.
          Run `flutter doctor --android-licenses` to accept the SDK licenses.
          See https://flutter.dev/docs/get-started/install/macos#android-setup for
          more details.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 13C100
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] IntelliJ IDEA Ultimate Edition (version 2021.3.2)
        • IntelliJ at /Applications/IntelliJ IDEA.app
        • Flutter plugin version 65.1.4
        • Dart plugin version 213.7228
    
    [✓] VS Code (version 1.62.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.29.0
    
    [✓] Connected device (3 available)
        • Darshan's iphone (mobile) • 21150b119064aecc249dfcfe05e259197461ce23 • ios
          • iOS 15.3.1 19D52
        • macOS (desktop)           • macos                                    •
          darwin-x64     • macOS 12.2.1 21D62 darwin-x64
        • Chrome (web)              • chrome                                   •
          web-javascript • Google Chrome 109.0.5414.119
    
    [✓] Network resources
        • All expected network resources are available.
    
    ! Doctor found issues in 1 category.
          
    [!] Xcode - develop for iOS and macOS (Xcode 12.3)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        ! Flutter recommends a minimum Xcode version of 13.
          Download the latest version or update via the Mac App Store.
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] VS Code (version 1.62.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.21.0
    
    [✓] Connected device (5 available)
        • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
        • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
          ios            • iOS 14.4.1 18D61
        • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
          ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
        • macOS (desktop)            • macos                                    •
          darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
        • Chrome (web)               • chrome                                   •
          web-javascript • Google Chrome 98.0.4758.80
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
    
    
    
    
  7. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    p: material_uimaterial_ui package in flutter/packages
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    platform-webWeb applications specifically
    team-designOwned by Design Languages team
    on Jan 31, 2024
  8. 6 remaining items

  9. jezell commented on Feb 1, 2024

    @jezell
    ContributorAuthor

    @HansMuller the key is whether the tap or the hover triggered the tooltip, not whether there was a hover. It's a bit weird that there isn't a hover "mode" but desktop is always hover mode, which is probably just wrong if you actually want rich tooltips on desktop:

    https://api.flutter.dev/flutter/material/TooltipTriggerMode.html

    I think appropriate solution is probably a "hover" mode being added to the enum, hover being the default on desktop and web only if unspecified, but allowed to be overridden, and ignorePointer being implied by mode = hover.

    ignorePointer option on the tooltip would also solve the problem, but this kind of points to a larger issue with rich tooltips that might need a mode option to really solve.

  10. npateras commented on Jul 5, 2024

    @npateras

    @HansMuller the key is whether the tap or the hover triggered the tooltip, not whether there was a hover. It's a bit weird that there isn't a hover "mode" but desktop is always hover mode, which is probably just wrong if you actually want rich tooltips on desktop:

    https://api.flutter.dev/flutter/material/TooltipTriggerMode.html

    I think appropriate solution is probably a "hover" mode being added to the enum, hover being the default on desktop and web only if unspecified, but allowed to be overridden, and ignorePointer being implied by mode = hover.

    ignorePointer option on the tooltip would also solve the problem, but this kind of points to a larger issue with rich tooltips that might need a mode option to really solve.

    That does sound much better actually

  11. Trung15010802 commented on Jul 16, 2024

    @Trung15010802

    any solution?

  12. benji-farquhar commented on Jan 8, 2025

    @benji-farquhar
    Contributor

    @HansMuller the key is whether the tap or the hover triggered the tooltip, not whether there was a hover. It's a bit weird that there isn't a hover "mode" but desktop is always hover mode, which is probably just wrong if you actually want rich tooltips on desktop:

    https://api.flutter.dev/flutter/material/TooltipTriggerMode.html

    I think appropriate solution is probably a "hover" mode being added to the enum, hover being the default on desktop and web only if unspecified, but allowed to be overridden, and ignorePointer being implied by mode = hover.

    ignorePointer option on the tooltip would also solve the problem, but this kind of points to a larger issue with rich tooltips that might need a mode option to really solve.

    It’s valid to have rich tooltips triggered by hovering. Trigger mode, the type of message (plain or rich), and whether pointer events are ignored are all orthogonal concerns. For example, it’s reasonable to want to ignore pointer events even on rich content, especially if the content is purely decorative (e.g., styled text or icons without interactive elements).

    The simplest solution is to provide an ignorePointer flag, giving developers the flexibility to choose the desired behavior based on their use case.

    I've done a POC with IgnorePointer that works. I can probably refine and do a PR soon.

  13. moved this from To do to In progress in Nevercodeon Mar 5, 2025
  14. huycozy commented on Mar 5, 2025

    @huycozy
    Member

    Thanks for the report, @jezell!
    This was fixed by #161363 and is available on the latest Flutter beta, master channels so please switch to these channels and retry.

    Demo screenshot/video
    Screen.Recording.2025-03-05.at.15.47.20.mov
    flutter doctor -v
    [!] Flutter (Channel beta, 3.30.0-0.1.pre, on macOS 15.3.1 24D70 darwin-x64, locale en-VN) [841ms]
        • Flutter version 3.30.0-0.1.pre on channel beta at /Users/huynq/Documents/GitHub/flutter_beta
        ! Warning: `flutter` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_beta. Consider adding /Users/huynq/Documents/GitHub/flutter_beta/bin to the front of your path.
        ! Warning: `dart` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_beta. Consider adding /Users/huynq/Documents/GitHub/flutter_beta/bin to the front of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 360a12c848 (2 weeks ago), 2025-02-14 13:36:09 -0800
        • Engine revision 29a2f674ca
        • Dart version 3.8.0 (build 3.8.0-70.0.dev)
        • DevTools version 2.43.0
        • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 35.0.1) [4.3s]
        • Android SDK at /Users/huynq/Library/Android/sdk
        • Platform android-35, build-tools 35.0.1
        • ANDROID_HOME = /Users/huynq/Library/Android/sdk
        • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
          This JDK is specified in your Flutter configuration.
          To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
        • Java version OpenJDK Runtime Environment (build 21.0.5+-12932927-b750.29)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 16.2) [1,940ms]
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 16C5032a
        • CocoaPods version 1.16.2
    
    [✓] Chrome - develop for the web [41ms]
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2024.3) [39ms]
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • android-studio-dir = /Applications/Android Studio.app
        • Java version OpenJDK Runtime Environment (build 21.0.5+-12932927-b750.29)
    
    [✓] VS Code (version 1.97.2) [37ms]
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.106.0
    
    [✓] Connected device (4 available) [7.4s]
        • Pixel 7 (mobile)                      • 2B171FDH20084L            • android-arm64  • Android 15 (API 35)
        • iPhone 16 pro max (wireless) (mobile) • 00008140-00194CC23A68801C • ios            • iOS 18.3.1 22D72
        • macOS (desktop)                       • macos                     • darwin-x64     • macOS 15.3.1 24D70 darwin-x64
        • Chrome (web)                          • chrome                    • web-javascript • Google Chrome 133.0.6943.142
    
    [✓] Network resources [518ms]
        • All expected network resources are available.
    
    ! Doctor found issues in 1 category.
    

    I'll close this issue as fixed on the latest channels. The fix should be landed on stable channel.

  15. moved this from In progress to Done (PR merged) in Nevercodeon Mar 5, 2025
  16. added
    r: fixedIssue is closed as already fixed in a newer version
    on Mar 5, 2025
  17. moved this from Done (PR merged) to Issue closed with comment in Nevercodeon Mar 5, 2025
  18. github-actions commented on Mar 19, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  19. locked as resolved and limited conversation to collaborators on Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: desktopRunning on desktopfound in release: 3.16Found to occur in 3.16found in release: 3.19Found to occur in 3.19frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesplatform-webWeb applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    • Status
      Issue closed with comment

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions