W3C home > Mailing lists > Public > public-webevents@w3.org > April to June 2011

Re: preventDefault research

From: Andrew Grieve <agrieve@google.com>
Date: Tue, 26 Apr 2011 21:58:06 -0400
Message-ID: <BANLkTi=+xmaRi7jujTH4S-UjWbEMWv0W1w@mail.gmail.com>
To: Matt Brubeck <mbrubeck@mozilla.com>
Cc: "public-webevents@w3.org" <public-webevents@w3.org>
On Tue, Apr 26, 2011 at 7:39 PM, Matt Brubeck <mbrubeck@mozilla.com> wrote:

> I'm doing some of my own research on preventDefault behavior for touch
> events, because we are busy implementing this in Firefox.  Here's a test
> page that others might find useful:
> http://limpet.net/w3/touchevents/preventDefault.html
>
> Safari, Android WebKit, and Opera Mobile 11 all display the following
> behaviors:
>
> 1) preventDefault on the touchstart event prevents scrolling and
> mouseup/mousedown/click events.
>
> 2) preventDefault on the touchmove event prevents scrolling.
>

I can be a bit more exact for Android/iOS:
I'm fairly sure that preventDefault only prevents scrolling on android if
you call it on the very first touchmove event.
On iOS, if you call preventDefault on a single touchmove event at any point
before scroll mode is entered then scrolling will be disabled for the
duration of the touch (not necessarily the very first touchmove).

Also note that if one finger has disabled page scrolling through a
preventDefault() on touchstart / touchmove, then a second touch that occurs
at the same time will not be able to scroll the page (at least on iOS).


> 3) preventDefault on the touchend event does NOT prevent scrolling or mouse
> events.
>
I believe that it will prevent a click from firing on the latest iOS and on
the Playbook.
Received on Wednesday, 27 April 2011 01:58:51 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 27 April 2011 01:58:52 GMT