Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information