How to disable ALT key default behavior from javascript
I am writing a canvas-based RPG game. I use keyboard to control the player, including 'press and hold ALT key to highlight items'. Problem - when player is done highlighting and releases the ALT key, top level browser menu pops up, even if I call event.preventDefault(). Question - is there a way I can tell Firefox to not to do that - i know that end user can disable this behavior via about:config flag, but I can't just go and ask every user to do that... (Firefox 73) Thank you!
All Replies (3)
Alt without other modifiers is used for the accessing the menu bar in the user interface. For access keys on web page is Shift+Alt reserved, so without disabling the Alt key for opening the menu bar via a pref (ui.key.menuAccessKeyFocuses = false), like you probably know, I don't think there is a way to prevent this.
That is what I was afraid of... For some reason writing games for Firefox is especially hard - a lot of little things like this just keep popping up.. Thanks anyway!
Hi Serg Nights:
This is a user support focused forum and because of this there aren't many folks who can answer developer questions like your question.
The best place to ask dev questions for games and other web apps is stack overflow: https://stackoverflow.com/questions/tagged/firefox
More details: https://support.mozilla.org/en-US/kb/where-go-developer-support
Cheers!
...Roland