Skip to main content

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

Page is annoyingly scrolling with HTML build

A topic by AnonymousCoder created Jun 22, 2021 Views: 459 Replies: 4
Viewing posts 1 to 3

it's really annoying when on my web build, the page scrolls with arrow keys. even though it's supposed to focus on the game, it doesn't and the controls make the page scroll.. can this feature get removed please??

What engine are you using? 


You're supposed to intercept keyboard events when your html canvas is in focus, but usually the engine takes care of that (I know Unity WebGL builds do).

i'm using construct 3

(+1)

I don't know Construct 3, but I know I solved this problem in my own web engine earlier. I can look up the details tomorrow, maybe it's useful...

In my own web engine, the key to fixing this was adding "preventDefault()" to my key event handling method. FWIW, this is my method:

HandleKeyDown: function (e) {

                var keyCode = e.keyCode;

                [....some code to store / handle key input here...]

                if (keyCode !== Key.F11) {

                    e.preventDefault();

                }

            }

But more importantly, if you know what term to google for, you can find the solution. :-) 

This seems helpful in your case:

https://www.construct.net/en/forum/construct-3/how-do-i-8/keep-arrow-keys-scroll...