Skip to content

[Windows] F10 key breaks MouseRegion hover events #184462

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

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
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions