[html5] Ctrl + key shortcuts (Ctrl+S etc)

Hi,
I’m wondering if there is a way to use “classic” shortcuts in an OpenFL web application ? Right now when I hit Ctrl+S it’s the browser that reacts to it, is there a way to prevent that ?

I can remap shortcuts for web but that would probably just mean removing “Ctrl+” from them (like “S” to save, “shift+S” to save as etc)

1 Like

Generally, in JavaScript, you can call the preventDefault() method on a keyboard event to prevent the web browser from triggering its default behavior. There are probably some exceptions that cannot be cancelled, but I suspect that a majority can be cancelled.

If calling preventDefault() on an openfl.events.KeyboardEvent doesn’t end up calling the JS native preventDefault(), I would consider that a bug in OpenFL. Have you tried it?

1 Like

Thanks ! Seems to work perfectly

I keep forgetting about that prevenDefault thing for some reason :sweat_smile:

1 Like