Skip to content

Tooltip doesn't disappear when wrapped inside MouseRegion (Web) #134656

@marty-isync

Description

@marty-isync

Is there an existing issue for this?

Steps to reproduce

I am using MouseRegion to show an IconButton when the mouse enters the region and hides the button when the mouse exits the region. The IconButton has a tooltip and shows correctly, however, the tooltip doesn't disappear when moving the mouse vertically away from the tooltip.

flutter_tooltip_bug_aNvhh8aklk

Expected results

The tooltip disappears when moving the mouse vertically.

Actual results

The tooltip sticks until the same tooltip is shown again.

Code sample

Code sample
class TooltipExamplePage extends StatefulWidget {
  const TooltipExamplePage({super.key});

  @override
  State<TooltipExamplePage> createState() => _TooltipExamplePageState();
}

class _TooltipExamplePageState extends State<TooltipExamplePage> {
  bool showButton = false;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        color: Colors.blueGrey,
        child: Center(
          child: MouseRegion(
              onEnter: (event) => _showButton(true),
              onExit: (event) => _showButton(false),
              child: Container(
                  color: Colors.white,
                  height: 50,
                  width: 100,
                  child: Stack(
                    children: [
                      const Center(child: Text('HOVER HERE')),
                      if (showButton)
                        Positioned(
                          top: 0,
                          right: 0,
                          child: IconButton(
                            onPressed: () {},
                            icon: const Icon(Icons.delete),
                            tooltip: 'Tooltip Example',
                          ),
                        )
                    ],
                  ))),
        ),
      ),
    );
  }

  void _showButton(bool show) {
    setState(() {
      showButton = show;
    });
  }
}

Screenshots or Video

No response

Logs

No response

Flutter Doctor output

Doctor output
[√] Flutter (Channel stable, 3.13.3, on Microsoft Windows [Version 10.0.22621.2283], locale en-US)
    • Flutter version 3.13.3 on channel stable at C:\Users\User\Documents\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2524052335 (7 days ago), 2023-09-06 14:32:31 -0700
    • Engine revision b8d35810e9
    • Dart version 3.1.1
    • DevTools version 2.25.0

[√] Windows Version (Installed version of Windows is version 10 or higher)

[X] Android toolchain - develop for Android devices
    X Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.6.2)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.6.33723.286
    • Windows 10 SDK version 10.0.22621.0

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).

[√] VS Code, 64-bit edition (version 1.82.1)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.72.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22621.2283]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 116.0.5845.188
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 116.0.1938.76

[√] Network resources
    • All expected network resources are available.

! Doctor found issues in 2 categories.

Metadata

Metadata

Labels

P2Important issues not at the top of the work lista: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)a: desktopRunning on desktopa: mouseIssues related to using a mouse or mouse supportf: material designflutter/packages/flutter/material repository.found in release: 3.13Found to occur in 3.13found in release: 3.14Found to occur in 3.14frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions