Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Option to prevent keyboard page scrolling for embedded html games

A topic by Gaeel created Jul 29, 2020 Views: 1,295 Replies: 1
Viewing posts 1 to 2
(+2)

As an example, this game accepts arrow keys and space bar for in-game actions, but unless the player has chosen to play in full-screen mode, the page scrolls if they use the up, down and space keys  
It would be useful, when configuring the page, to have an option that prevents this behaviour

In my case, the game has code to catch and prevent scrolling, but unfortunately, it only affects the game's page, and not the itch.io host page, and unless I'm mistaken, there doesn't seem to be a way to do this from within the embedded page

Admin (1 edit) (+1)

For accessibility reasons I don’t think we’ll change the default keyboard behavior if the user has the focus set to the outer page. If I remember correctly, we do transfer focus to the iframe when they click the launch button. For games that automatically start, the user will always have to manually focus into the game to ensure that the outer page can be accessibly accessed by default via the keyboard. So if you’re concerned about focus, I recommend disabling “automatically start on page load.”