#bevy-plugin #web #cursor #fix #keyboard-events #bevy #issue #escaping

bevy_fix_cursor_unlock_web

A tiny plugin that fixes Bevy not reporting when the cursor is unlocked on web

3 releases

Uses new Rust 2024

0.1.2 May 8, 2025
0.1.1 May 8, 2025
0.1.0 May 8, 2025

#971 in Game dev

Download history 332/week @ 2025-05-05 326/week @ 2025-05-12 134/week @ 2025-05-19 156/week @ 2025-05-26 399/week @ 2025-06-02 93/week @ 2025-06-09 45/week @ 2025-06-16 82/week @ 2025-06-23 52/week @ 2025-06-30

323 downloads per month
Used in foxtrot

MIT/Apache

38KB
100 lines

Fix Cursor Unlock on Web

crates.io docs.rs

A tiny plugin that fixes Bevy not reporting when the cursor is unlocked on web

Usage

Just add the plugin, that's it:

use bevy::prelude::*;
use bevy_fix_cursor_unlock_web::prelude::*;

App::new()
  .add_plugins(DefaultPlugins)
  .add_plugins(FixPointerUnlockPlugin);

Now, Window::cursor_options::grab_mode is automatically set to CursorGrabMode::None for you when unlocking the cursor on web.
This fixes https://github.com/bevyengine/bevy/issues/8949

It will also automatically forward the keyboard event for pressing Escape, which would be ignored otherwise.

Compatibility

bevy bevy_fix_cursor_unlock_web
0.16 0.1

Dependencies

~19–31MB
~564K SLoC