Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WASM: Embedded views should lock the keyboard #8

Open
zeta0134 opened this issue Dec 28, 2024 · 0 comments
Open

WASM: Embedded views should lock the keyboard #8

zeta0134 opened this issue Dec 28, 2024 · 0 comments

Comments

@zeta0134
Copy link
Owner

As reported by several users on the NESDev discord, when used as an itch embed, Rustico is allowing keypress events to propagate to the rest of the page, which mostly means attempting to control the game with arrows is causing unwanted scrolling.

We should try to prevent this if we can. There seems to be a keyboard locking API in some browsers, which we could call when the main window is clicked https://developer.mozilla.org/en-US/docs/Web/API/Keyboard/lock

Separately, we may be able to use prevent default when handling the bound keys, which may be somewhat more portable, as the above feature doesn't appear to be supported by Firefox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant