bevy/crates/bevy_winit/src
Johan Klokkhammer Helsing 7ebc68bb84 Allow not preventing default event behaviors on wasm (#7304)
# Objective

On wasm, bevy applications currently prevent any of the normal browser hotkeys from working normally (Ctrl+R, F12, F5, Ctrl+F5, tab, etc.).

Some of those events you may want to override, perhaps you can hold the tab key for showing in-game stats?

However, if you want to make a well-behaved game, you probably don't want to needlessly prevent that behavior unless you have a good reason.

Secondary motivation: Also, consider the workaround presented here to get audio working: https://developer.chrome.com/blog/web-audio-autoplay/#moving-forward ; It won't work (for keydown events) if we stop event propagation.

## Solution

- Winit has a field that allows it to not stop event propagation, expose it on the window settings to allow the user to choose the desired behavior. Default to `true` for backwards compatibility.

---

## Changelog

- Added `Window::prevent_default_event_handling` . This allows bevy apps to not override default browser behavior on hotkeys like F5, F12, Ctrl+R etc.
2023-01-22 23:35:32 +00:00
..
converters.rs Windows as Entities (#5589) 2023-01-19 00:38:28 +00:00
lib.rs break feedback loop when moving cursor (#7298) 2023-01-21 00:01:28 +00:00
system.rs expose cursor position with scale (#7297) 2023-01-20 14:25:24 +00:00
web_resize.rs Windows as Entities (#5589) 2023-01-19 00:38:28 +00:00
winit_config.rs Docs: App::run() might never return; effect of WinitSettings::return_from_run. (#7228) 2023-01-18 23:02:38 +00:00
winit_windows.rs Allow not preventing default event behaviors on wasm (#7304) 2023-01-22 23:35:32 +00:00