Repository navigation
[Windows] F10 key breaks MouseRegion hover events #184462
Copy link
Copy link
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: desktopRunning on desktopRunning on desktopframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.platform-windowsBuilding on or for Windows specificallyBuilding on or for Windows specificallyteam-windowsOwned by the Windows platform teamOwned by the Windows platform teamtriaged-windowsTriaged by the Windows platform teamTriaged by the Windows platform team
Description
Steps to reproduce
- Use the code sample
- Hover over the grey box, it turns blue
- Move mouse away from the box, it turns grey
- Press F10
- 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 resourcesReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: desktopRunning on desktopRunning on desktopframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.platform-windowsBuilding on or for Windows specificallyBuilding on or for Windows specificallyteam-windowsOwned by the Windows platform teamOwned by the Windows platform teamtriaged-windowsTriaged by the Windows platform teamTriaged by the Windows platform team
Activity
puneetkukreja98 commentedon Apr 2, 2026
@9AZX Thanks for reporting it.
I was able to reproduce this on latest stable.
Steps to reproduce
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:
knopp commentedon Apr 9, 2026
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
DefWindowProconWM_SYSKEYUP.Win32: Prevent mouse leave on WM_SYSKEYUP. (#184835)
Win32: Prevent mouse leave on WM_SYSKEYUP. (flutter#184835)
github-actions commentedon Apr 24, 2026
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 -vand a minimal reproduction of the issue.