I want to make a fly-out menu using the tab key. However, it’s trying to change the focus to the address bar, bookmark button, etc. on my browser. How do I prevent this action and reserve the tab key for my game?
I know JavaScript, including event.preventDefault()
, but I don’t know how I would implement it in my game.
Solved it.
Just had to add this JS to run at the beginning of the scene:
document.addEventListener('keydown', function(event) {
if (event.key === 'Tab' || event.keyCode === 9) {
event.preventDefault();
}
});
Attached is an extension for people with a similar problem, but without the need for a giant JavaScript block in your events sheet.
drive.google.com/file/d/1ZxDPlDZNEYx69Loo8j6siUL7J3Oik5gn