Emscripten disable js prevent default on keyboard


On the Emscripten port, is there a way to disable keyboard capture from the port, at least temporarily? I am trying to put a game inside JS app, and the keyboard is being grabbed by the JS from the emscripten port making my text boxes not work.

Also, should I use the default SDL2 for emscripten, using USE_SDL=2, which I think downloads from here: https://github.com/emscripten-ports/SDL2 , or the one that is on the libsdl repository?

I would say yes. That’s what I do, and everything works. The last time this came up ‘standard’ SDL2 still didn’t enable atomics etc. necessary for multi-threaded operation when compiled for Emscripten. That may have changed now, but I still think USE_SDL=2 is safer.


The generated is part of the code has a prevent default for all keyboard events, but I could not figure out from where that code comes from.

I can edit the code after it has been generated and manually make a switch to not do that - and also not to forward to the SDL2 game - but I am looking in a way I can do this without having to do this, since it’s work that goes away next time I build the code.