[whatwg] Is there a way to stop scrolling when pressing directional arrows?

Kornel Lesinski kornel at geekhood.net
Mon Jun 14 15:16:13 PDT 2010


On Mon, 14 Jun 2010 20:38:07 +0100, Carlos Andrés Solís  
<csolisr at gmail.com> wrote:

> Hello! I've been noticing a problem in many HTML5 test apps, very  
> especially games. When the directional arrow buttons are pressed, the  
> screen scrolls.
> This is a problem that, as far as I know, Flash had solved by changing  
> the focus of the application to the app. Is this doable in HTML5?

Yes. It's possible already — page just has to return false from keypress  
handler:

window.onkeypress = function(){return false}

That's just one line that, unfortunately, many web-based games forget to  
include.

-- 
regards, Kornel Lesiński



More information about the whatwg mailing list