Skip to content

[Windows] F10 key breaks MouseRegion hover events #184462

Closed

Description

@9AZX

Steps to reproduce

  1. Use the code sample
  2. Hover over the grey box, it turns blue
  3. Move mouse away from the box, it turns grey
  4. Press F10
  5. Move mouse over the box again

Expected results

The box turns blue when the mouse enters it, just like before pressing F10.
The Material button should also display the Hover state.

Actual results

The box stays grey. MouseRegion.onEnter/onExit and Listener.onPointerHover no longer fire. Hover events only resume after clicking inside the window.
The button doesn't show an Hover state.

Code sample

Code sample
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() => runApp(const MaterialApp(home: Home()));

class Home extends StatefulWidget {
  const Home({super.key});

  @override
  State<Home> createState() => _HomeState();
}

class _HomeState extends State<Home> {
  bool _hovering = false;
  bool _f10Pressed = false;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: CallbackShortcuts(
        bindings: {
          LogicalKeySet(LogicalKeyboardKey.f10): () => setState(() => _f10Pressed = true),
        },
        child: Focus(
          autofocus: true,
          child: Center(
            child: Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                MouseRegion(
                  onEnter: (_) => setState(() => _hovering = true),
                  onExit: (_) => setState(() => _hovering = false),
                  child: Container(
                    width: 300,
                    height: 300,
                    color: _hovering ? Colors.blue : Colors.grey,
                    child: Center(
                      child: Text(
                        _f10Pressed
                            ? 'F10 pressed!\n\nNow move mouse out and back in.\nBox should turn blue on hover.'
                            : 'Press F10, then move mouse\nout and back in.\n\nShould turn blue on hover.',
                        textAlign: TextAlign.center,
                        style: const TextStyle(color: Colors.white, fontSize: 16),
                      ),
                    ),
                  ),
                ),
                const SizedBox(height: 16),
                ElevatedButton(
                  onPressed: () => setState(() => _f10Pressed = false),
                  child: const Text('Reset'),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

On Windows (with the issue)

Screen.Recording.2026-04-01.at.17.11.10.mov

On macOS no issue:

Screen.Recording.2026-04-01.at.17.12.15.mov

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[!] Flutter (Channel main, 3.43.0-1.0.pre-78, on Microsoft Windows [version 10.0.26100.7840], locale fr-FR)
    ! Warning: `flutter` on your path resolves **redacted**
    ! Warning: `dart` on your path resolves to **redacted**
[✓] Windows Version (Windows 11 or higher, 24H2, 2009)
[✗] Android toolchain - develop for Android devices
    ✗ 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/to/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
[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.13.6)
[✓] Connected device (3 available)
[✓] Network resources

Activity

  1. puneetkukreja98 commented on Apr 2, 2026

    @puneetkukreja98
    Contributor

    @9AZX Thanks for reporting it.
    I was able to reproduce this on latest stable.

    Steps to reproduce

    1. Use the code sample
    2. Hover over the grey box, it turns blue
    3. Move mouse away from the box, it turns grey
    4. Windows machine - (Press fn+ F10) - (It will change state and show text in box -> F10 pressed!)
    5. Move mouse over the box again - Mouse region onEnter, onExit not working.

    Tested on macOS working fine.
    Edit : Tested on web platform also, using both machines windows and mac - Mouse region onEnter, onExit working fine

    Flutter doctor -v:

    [√] Flutter (Channel stable, 3.41.6, on Microsoft Windows [Version 10.0.26200.7840], locale en-IN) [323ms]
        • Flutter version 3.41.6 on channel stable at C:\Developer\flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision db50e20168 (7 days ago), 2026-03-25 16:21:00 -0700
        • Engine revision 425cfb54d0
        • Dart version 3.11.4
        • DevTools version 2.54.2
        • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android,
          enable-ios, cli-animations, enable-native-assets, omit-legacy-version-file, enable-lldb-debugging,
          enable-uiscene-migration
    
    [√] Windows Version (Windows 11 or higher, 25H2, 2009) [2.2s]
    
    [√] Android toolchain - develop for Android devices (Android SDK version 36.1.0) [3.5s]
        • Android SDK at C:\Users\Puneet\AppData\Local\Android\sdk
        • Emulator version 36.4.9.0 (build_id 14788078) (CL:N/A)
        • Platform android-36.1, build-tools 36.1.0
        • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
          This is the JDK bundled with the latest Android Studio installation on this machine.
          To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
        • Java version OpenJDK Runtime Environment (build 21.0.9+-14649483-b1163.86)
        • All Android licenses accepted.
    
    [√] Chrome - develop for the web [106ms]
        • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
    
    [√] Visual Studio - develop Windows apps (Visual Studio Community 2026 18.3.2) [105ms]
        • Visual Studio at C:\Program Files\Microsoft Visual Studio\18\Community
        • Visual Studio Community 2026 version 18.3.11520.95
        • Windows 10 SDK version 10.0.26100.0
    
    [√] Connected device (3 available) [271ms]
        • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.26200.7840]
        • Chrome (web)      • chrome  • web-javascript • Google Chrome 145.0.7632.160
        • Edge (web)        • edge    • web-javascript • Microsoft Edge 146.0.3856.97
    
    [√] Network resources [1,150ms]
        • All expected network resources are available.
    
    • No issues found!
  2. added
    team-windowsOwned by the Windows platform team
    platform-windowsBuilding on or for Windows specifically
    frameworkflutter/packages/flutter repository. See also f: labels.
    and removed
    in triagePresently being triaged by the triage team
    on Apr 2, 2026
  3. added
    P2Important issues not at the top of the work list
    triaged-windowsTriaged by the Windows platform team
    on Apr 8, 2026
  4. knopp commented on Apr 9, 2026

    @knopp
    Member

    So what happens here is that the default proc for WM_SYSKEYUP (which is dispatched on Alt, F10, etc) unfocuses window and sends WM_MOUSELEAVE. Which basically disables mouse tracking until the window is refocuses either by clicking on it or pressing the syskey again.

    The fix should be fairly straightforward, preventing DefWindowProc on WM_SYSKEYUP.

  5. github-actions commented on Apr 24, 2026

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

  6. locked as resolved and limited conversation to collaborators on Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: desktopRunning on desktopframeworkflutter/packages/flutter repository. See also f: labels.platform-windowsBuilding on or for Windows specificallyteam-windowsOwned by the Windows platform teamtriaged-windowsTriaged by the Windows platform team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions