bevyengine / bevyengine/bevy

`KeyboardInput` events not being triggered by MacOS native overlays

Open
#13,356 0 comments 1 reaction 0 assignees View on GitHub
A-Input A-Windowing C-Bug O-MacOS
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## Bevy version

v13.2

## Relevant system information

This happens on MacOS Sonoma 14.3 and I've been able to confirm it on other people's machines.

## What you did

Running `cargo run --example keyboard_input_events` on Mac shows this issue in action.

## What went wrong

Triggering a MacOS native UI overlay, such as with `CMD+Shift+4` doesn't release the keys pressed.

https://github.com/bevyengine/bevy/assets/9288430/78831239-badc-462f-a057-9170e11f297d

In the `winit` repo `window` example, I see the modifier state is being changed when I exit the overlay.

https://github.com/bevyengine/bevy/assets/9288430/ad1b9ecc-03ec-45c8-b923-b68bef2c577e

Using the `KeyboardInput` system in Bevy, however, I don't see any events being fired for those changes, so in our app the modifier keys remain pressed. I think this may just be Bevy not propagating the `winit` events 🤔 though not sure why just MacOS `CMD` seems to be affected.

Contributor guide

Open the contributing guide

Research direction

Start by running `cargo run --example keyboard_input_events` on macOS and reproducing the native overlay behavior. Compare the modifier-state changes in the winit repository's `window` example with the events observed by Bevy's KeyboardInput system. Done means modifier keys are released correctly after leaving the overlay and the relevant input behavior is covered by a regression check.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.