SlideShare una empresa de Scribd logo
1 de 57
Descargar para leer sin conexión
Hell is other browsers - Sartre


    The touch events

        Peter-Paul Koch (ppk)
      http://quirksmode.org
      http://twitter.com/ppk
WebExpo, 24 September 2010
The desktop web
Boring!

-   Only five browsers
-   with only one viewport each
-   that support nearly everything
-   Even IE? Yes, even IE.
The Mobile Web
Exciting!

- Fifteen browsers and counting
- ranging from great to lousy
- Interesting new bugs
- About five times as many users as the
  desktop web (eventually)
- New interaction modes
The Mobile Web
Exciting!

- Fifteen browsers and counting
- ranging from great to lousy
- Interesting new bugs
- About five times as many users as the
  desktop web (eventually)
- New interaction modes
Mobile browsers
-   Android WebKit      -   NetFront
-   Opera Mobile        -   Bolt
-   Dolfin (bada)       -   UCWeb
-   Safari              -   Obigo
-   MicroB              -   Fennec
-   BlackBerry WebKit   -   Opera Mini
-   Symbian WebKit
-   IE Mobile
-   Palm WebKit
You may groan now.
Mobile browsers
-   Android WebKit        -   NetFront
-   Opera Mobile          -   Bolt
-   Dolfin (bada)         -   UCWeb
-   Safari                -   Obigo
-   MicroB                -   Fennec
-   BlackBerry WebKit     -   Opera Mini
-   Symbian WebKit
-   IE Mobile
-   Palm WebKit
These are all WebKit-based.
WebKit Mobile
There is no WebKit on Mobile.
There's iPhone Safari (3 and 4),
and Android (1.6 and 2.1 and 2.2)
and Symbian WebKit (1 and 2)
and Blackberry WebKit
and Palm WebKit
and Dolfin for bada


These WebKits are all different.
There is no WebKit on Mobile.
http://quirksmode.org/webkit.html
Mobile web dev
Focus on (in roughly this order)
- iPhone
- Android
- BlackBerry (WebKit and old)
- Symbian WebKit
- Opera Mini
- Opera Mobile
- Dolfin (bada)
Mobile web dev
Focus on (in roughly this order)
- iPhone
- Android
- BlackBerry (WebKit and old)
- Symbian WebKit
- Opera Mini
- Opera Mobile
- Dolfin (bada)
Opera Mobile and Mini
Opera Mobile is a normal browser.
Request HTML, CSS, and JavaScript,
interpret and execute them.

Opera Mini, though, sends your request
to a special server,
which requests the HTML, CSS, and JS
then interprets it
and sends back basically a bitmap
Opera Mini
Opera Mini advantages:
- Little memory necessary, works on old
  phones, too.
- Less network traffic: you receive a
  highly compressed bitmap
Opera Mini
Opera Mini disadvantage:
- No client-side interactivity. If a click
  event fires, Opera Mini goes back to
  the server to ask for instructions

Tradeoff: lose client-side interactivity,
but spend less money on devices and
network connections.
Mobile web dev
Focus on (in roughly this order)
- iPhone
- Android
- BlackBerry (WebKit and old)
- Symbian WebKit
- Opera Mini
- Opera Mobile
- Dolfin (bada)
Mobile web dev
Get real devices to test on.
- iPhone or Android
- Nokia S60
- BlackBerry (older)
- Windows Mobile (useful secondary test
  platform)

Yes, that's expensive.
It's also necessary.
Mobile web dev
Get real devices to test on.

- Unlocked! You should test with
  multiple networks
- or with wifi
Mobile web dev
Use testing services:

http://www.deviceanywhere.com/
http://perfectomobile.com/

Or use an emulator. Most mobile phone
vendors offer one.
Drawback: you can't hold them in your
hand, and that's crucial for mobile.
The Mobile Web
Exciting!

- Fifteen browsers and counting
- ranging from great to lousy
- Interesting new bugs
- About five times as many users as the
  desktop web (eventually)
- New interaction modes
Before we start
please open the following link on your
phone:

http://quirksmode.org/touchevents

It gives links to the test files.
The touch tests only work on iPhone,
Android, bada, and BlackBerry Torch.
Mouse
Mouse




Keyboard
Mouse




Keyboard




Touch
Keyboard users need different Mouse
interaction than mouse users
need different interactions than touch
users.

Your script accomodates all three
modes, right?

It's all a question of events.
keydown
keypress
keyup
mouseover
mouseout
mousedown
mouseup
mousemove
touchstart
touchmove
touchend
touchcancel
It's not an either-or proposition.
It's not an either-or proposition.

                         The Nokia E71
                         has a four-way
                         navigation.
                         Works like the
                         arrow keys
                         (including
                         keycodes).

                         But...
It's not an either-or proposition.

                         But...
                         the “arrow keys”
                         steer a mouse
                         cursor.

                         Key events
                         and mouse
                         events
Today we'll concentrate on the touch
events, though.
http://quirksmode.org/touchevents

Open the first dropdown example.

Task: Click on option 3.2

This is with traditional mouseover and
mouseout; no touch-specific code.
Works (a bit oddly, but works).
In theory a touchscreen device should
fire only the touch events, and not the
mouse events.

A touchscreen device doesn't have a
mouse, after all.

However, too many websites depend on
the mouse events, so touch browser
vendors are forced to support them,
too.
Touch !== mouse
-   Area
-   Pressure
-   Temperature
-   more than one touch
http://quirksmode.org/touchevents

Now open the second dropdown
example.

Task: Click on option 3.2

Doesn't work.
Not an entirely fair comparison.

Touchstart and touchend are not the
equivalents of mouseover and
mouseout.

In fact, true hovering is impossible on
touchscreens.
There is no way of saying “I might be
interested in this element but I'm not
sure yet.”
Interaction modes
Mouse       Keyboard Touch
mousedown   keydown    touchstart
mousemove   keypress   touchmove
mouseup     keyup      touchend
mouseover   focus      -
mouseout    blur       -
All         All        iPhone,
                       Android, bada,
                       BlackBerry
Interaction modes
Mouse         Keyboard Touch
mousedown     keydown        touchstart
mousemove     keypress       touchmove
mouseup       keyup          touchend
mouseover     focus          -
mouseout      blur           -
load, unload, click, submit, resize,
zoom, change etc. etc.
Interaction modes
Mouse         Keyboard Touch
mousedown     keydown        touchstart
mousemove     keypress       touchmove
mouseup       keyup          touchend
mouseover     focus          -
mouseout      blur           -
load, unload, click, submit, resize,
zoom, change etc. etc.
Interaction modes
Mouse         Keyboard Touch
mousedown     keydown        touchstart
mousemove     keypress       touchmove
mouseup       keyup          touchend
mouseover     focus          -
mouseout      blur           -
load, unload, click, submit, resize,
zoom, change etc. etc.
Interaction modes
Mouse         Keyboard Touch
mousedown     keydown        touchstart
mousemove     keypress       touchmove
mouseup       keyup          touchend
mouseover     focus          -
mouseout      blur           -
load, unload, click, submit, resize,
zoom, change etc. etc.
When you touch the screen of a
touchscreen, both touch and mouse
events fire.

But the mouse events are a bit special.
They all fire at the same time.

http://quirksmode.org/touchevents

You can test the events for yourself at
the touch action test page.
touchstart
mouseover
mousemove (only one!)
mousedown
mouseup
click
:hover styles applied
Once started, the touch events keep
firing regardless of where your finger is.

element.ontouchmove = function () {
  // do stuff
}

This event handler continues firing even
if your finger leaves the element.

We need touchenter and touchleave
events for when finger enters or leaves
element.
touchstart      If a DOM change occurs
mouseover       onmouseover or
mousemove       onmousemove, the rest
mousedown       of the events is cancelled.
mouseup         (iPhone and Symbian)
click
:hover styles   applied
When the user touches another element
mouseout
:hover styles removed
http://quirksmode.org/touchevents

Try the Event Delegation page. Touch
the bordered div.

document.onclick = function () {
  // change divs
}

You click on a div, not on the document.
Still, the event bubbles up.
Except on the iPhone.
The iPhone does not register a click
event if the element you click on doesn't
have a click event handler.

document.onclick = function () {
  // change divs
}
div.onclick = function () {}

Now the div itself has a click event
handler, and event delegation works
fine.
http://quirksmode.org/touchevents

Now open the first drag-and-drop
example.

Should work fine; both on touch devices
and with a mouse.

This is very simple.
Mouse and touch events:

element.ontouchstart = function (e) {
  element.ontouchmove = function (e) {etc}
  element.ontouchend = function (e) {etc}

}
element.onmousedown = function (e) {
  document.onmousemove = function (e) {etc}
  document.onmouseup = function (e) {etc}
}
Mouse and touch events:

element.ontouchstart = function (e) {
  element.ontouchmove = function (e) {etc}
  element.ontouchend = function (e) {etc}
  element.onmousedown = null;
}
element.onmousedown = function (e) {
  document.onmousemove = function (e) {etc}
  document.onmouseup = function (e) {etc}
}


But how do you know whether to use the
mouse or the touch events?
http://quirksmode.org/touchevents

Now open the second drag-and-drop
example.

iPhone only.
Try dragging two or all three layers
simultaneously.
(A bit stilted, but you get the point.)
This is impossible on a desktop
computer. Two mice?

Useful for games, maybe (especially on
the iPad).

Does not work on other browsers: they
don't (yet) support true multitouch.
http://quirksmode.org/touchevents

Now open the scrolling layer example.

Works fine – on mobile.
But how do we port this to the other
interaction modes?
- keys: use arrow keys
- mouse: ???
Interaction modes

-   mouse
-   keyboard
-   touch
-   and a fourth....
Interaction modes

-   mouse
-   keyboard
-   touch
-   trackball

Generally fires a
mousemove event
Thank you!
       Questions?
http://quirksmode.org
http://twitter.com/ppk

I'll post these slides on my site.

Más contenido relacionado

La actualidad más candente (6)

Voices That Matter: JavaScript Events
Voices That Matter: JavaScript EventsVoices That Matter: JavaScript Events
Voices That Matter: JavaScript Events
 
Wii Ruby All Work And No Play Just Wont Do
Wii Ruby All Work And No Play Just Wont DoWii Ruby All Work And No Play Just Wont Do
Wii Ruby All Work And No Play Just Wont Do
 
Getting touchy - an introduction to touch and pointer events / Future of Web ...
Getting touchy - an introduction to touch and pointer events / Future of Web ...Getting touchy - an introduction to touch and pointer events / Future of Web ...
Getting touchy - an introduction to touch and pointer events / Future of Web ...
 
Intro to Google TV
Intro to Google TVIntro to Google TV
Intro to Google TV
 
Android UI Reference
Android UI ReferenceAndroid UI Reference
Android UI Reference
 
Flash Lite & Touch: build an iPhone-like dynamic list
Flash Lite & Touch: build an iPhone-like dynamic listFlash Lite & Touch: build an iPhone-like dynamic list
Flash Lite & Touch: build an iPhone-like dynamic list
 

Similar a The touch events - WebExpo

Getting touchy - an introduction to touch and pointer events (1 day workshop)...
Getting touchy - an introduction to touch and pointer events (1 day workshop)...Getting touchy - an introduction to touch and pointer events (1 day workshop)...
Getting touchy - an introduction to touch and pointer events (1 day workshop)...
Patrick Lauke
 
Getting touchy - an introduction to touch events / Webinale / Berlin 04.06.2013
Getting touchy - an introduction to touch events / Webinale / Berlin 04.06.2013Getting touchy - an introduction to touch events / Webinale / Berlin 04.06.2013
Getting touchy - an introduction to touch events / Webinale / Berlin 04.06.2013
Patrick Lauke
 
Getting touchy - an introduction to touch and pointer events / Workshop / Jav...
Getting touchy - an introduction to touch and pointer events / Workshop / Jav...Getting touchy - an introduction to touch and pointer events / Workshop / Jav...
Getting touchy - an introduction to touch and pointer events / Workshop / Jav...
Patrick Lauke
 
Getting touchy - an introduction to touch and pointer events / Web Rebels / O...
Getting touchy - an introduction to touch and pointer events / Web Rebels / O...Getting touchy - an introduction to touch and pointer events / Web Rebels / O...
Getting touchy - an introduction to touch and pointer events / Web Rebels / O...
Patrick Lauke
 
Getting touchy - an introduction to touch events / Sud Web / Avignon 17.05.2013
Getting touchy - an introduction to touch events / Sud Web / Avignon 17.05.2013Getting touchy - an introduction to touch events / Sud Web / Avignon 17.05.2013
Getting touchy - an introduction to touch events / Sud Web / Avignon 17.05.2013
Patrick Lauke
 
Getting touchy - Introduction to touch (and pointer) events / jQuery Europe 2...
Getting touchy - Introduction to touch (and pointer) events / jQuery Europe 2...Getting touchy - Introduction to touch (and pointer) events / jQuery Europe 2...
Getting touchy - Introduction to touch (and pointer) events / jQuery Europe 2...
Patrick Lauke
 
Getting touchy - an introduction to touch and pointer events (Workshop) / Jav...
Getting touchy - an introduction to touch and pointer events (Workshop) / Jav...Getting touchy - an introduction to touch and pointer events (Workshop) / Jav...
Getting touchy - an introduction to touch and pointer events (Workshop) / Jav...
Patrick Lauke
 
Getting touchy - an introduction to touch and pointer events / Sainté Mobile ...
Getting touchy - an introduction to touch and pointer events / Sainté Mobile ...Getting touchy - an introduction to touch and pointer events / Sainté Mobile ...
Getting touchy - an introduction to touch and pointer events / Sainté Mobile ...
Patrick Lauke
 

Similar a The touch events - WebExpo (20)

The touch events
The touch eventsThe touch events
The touch events
 
Getting touchy - an introduction to touch and pointer events (1 day workshop)...
Getting touchy - an introduction to touch and pointer events (1 day workshop)...Getting touchy - an introduction to touch and pointer events (1 day workshop)...
Getting touchy - an introduction to touch and pointer events (1 day workshop)...
 
Tips for building fast multi touch enabled web sites
 Tips for building fast multi touch enabled web sites Tips for building fast multi touch enabled web sites
Tips for building fast multi touch enabled web sites
 
Fast multi touch enabled web sites
Fast multi touch enabled web sitesFast multi touch enabled web sites
Fast multi touch enabled web sites
 
Getting touchy - an introduction to touch and pointer events (1 day workshop)...
Getting touchy - an introduction to touch and pointer events (1 day workshop)...Getting touchy - an introduction to touch and pointer events (1 day workshop)...
Getting touchy - an introduction to touch and pointer events (1 day workshop)...
 
Getting touchy - an introduction to touch events / Webinale / Berlin 04.06.2013
Getting touchy - an introduction to touch events / Webinale / Berlin 04.06.2013Getting touchy - an introduction to touch events / Webinale / Berlin 04.06.2013
Getting touchy - an introduction to touch events / Webinale / Berlin 04.06.2013
 
Cucumber meets iPhone
Cucumber meets iPhoneCucumber meets iPhone
Cucumber meets iPhone
 
Getting touchy - an introduction to touch and pointer events / Workshop / Jav...
Getting touchy - an introduction to touch and pointer events / Workshop / Jav...Getting touchy - an introduction to touch and pointer events / Workshop / Jav...
Getting touchy - an introduction to touch and pointer events / Workshop / Jav...
 
Getting touchy - an introduction to touch and pointer events / Web Rebels / O...
Getting touchy - an introduction to touch and pointer events / Web Rebels / O...Getting touchy - an introduction to touch and pointer events / Web Rebels / O...
Getting touchy - an introduction to touch and pointer events / Web Rebels / O...
 
Patrick H. Lauke - Getting Touchy; an introduction to touch and pointer events
Patrick H. Lauke - Getting Touchy; an introduction to touch and pointer eventsPatrick H. Lauke - Getting Touchy; an introduction to touch and pointer events
Patrick H. Lauke - Getting Touchy; an introduction to touch and pointer events
 
Getting touchy - an introduction to touch events / Sud Web / Avignon 17.05.2013
Getting touchy - an introduction to touch events / Sud Web / Avignon 17.05.2013Getting touchy - an introduction to touch events / Sud Web / Avignon 17.05.2013
Getting touchy - an introduction to touch events / Sud Web / Avignon 17.05.2013
 
Getting touchy - Introduction to touch (and pointer) events / jQuery Europe 2...
Getting touchy - Introduction to touch (and pointer) events / jQuery Europe 2...Getting touchy - Introduction to touch (and pointer) events / jQuery Europe 2...
Getting touchy - Introduction to touch (and pointer) events / jQuery Europe 2...
 
T3con10_html5_kosack_zinner
T3con10_html5_kosack_zinnerT3con10_html5_kosack_zinner
T3con10_html5_kosack_zinner
 
Getting touchy - an introduction to touch and pointer events / Smashing Confe...
Getting touchy - an introduction to touch and pointer events / Smashing Confe...Getting touchy - an introduction to touch and pointer events / Smashing Confe...
Getting touchy - an introduction to touch and pointer events / Smashing Confe...
 
Multi Touch And Gesture Event Interface And Types
Multi Touch And Gesture Event Interface And TypesMulti Touch And Gesture Event Interface And Types
Multi Touch And Gesture Event Interface And Types
 
CSS for Touch Devices
CSS for Touch DevicesCSS for Touch Devices
CSS for Touch Devices
 
Getting touchy - an introduction to touch and pointer events (Workshop) / Jav...
Getting touchy - an introduction to touch and pointer events (Workshop) / Jav...Getting touchy - an introduction to touch and pointer events (Workshop) / Jav...
Getting touchy - an introduction to touch and pointer events (Workshop) / Jav...
 
Win7 Multi Touch
Win7 Multi TouchWin7 Multi Touch
Win7 Multi Touch
 
Getting touchy - an introduction to touch and pointer events / Sainté Mobile ...
Getting touchy - an introduction to touch and pointer events / Sainté Mobile ...Getting touchy - an introduction to touch and pointer events / Sainté Mobile ...
Getting touchy - an introduction to touch and pointer events / Sainté Mobile ...
 
Understanding the Touch Interface [IndicThreads Mobile Application Developmen...
Understanding the Touch Interface [IndicThreads Mobile Application Developmen...Understanding the Touch Interface [IndicThreads Mobile Application Developmen...
Understanding the Touch Interface [IndicThreads Mobile Application Developmen...
 

Más de Peter-Paul Koch

Rethinking the mobile web
Rethinking the mobile webRethinking the mobile web
Rethinking the mobile web
Peter-Paul Koch
 
The future of the mobile web
The future of the mobile webThe future of the mobile web
The future of the mobile web
Peter-Paul Koch
 
The mobile browser world
The mobile browser worldThe mobile browser world
The mobile browser world
Peter-Paul Koch
 

Más de Peter-Paul Koch (13)

Rethinking the mobile web
Rethinking the mobile webRethinking the mobile web
Rethinking the mobile web
 
The mobile browser world
The mobile browser worldThe mobile browser world
The mobile browser world
 
The future of the mobile web
The future of the mobile webThe future of the mobile web
The future of the mobile web
 
The mobile browser world
The mobile browser worldThe mobile browser world
The mobile browser world
 
JSON over SMS
JSON over SMSJSON over SMS
JSON over SMS
 
Samsung
SamsungSamsung
Samsung
 
The Mobile Web - Fronteers 2009
The Mobile Web - Fronteers 2009The Mobile Web - Fronteers 2009
The Mobile Web - Fronteers 2009
 
State of the Mobile Browsers
State of the Mobile BrowsersState of the Mobile Browsers
State of the Mobile Browsers
 
Vodafone Widget Camp
Vodafone Widget CampVodafone Widget Camp
Vodafone Widget Camp
 
The Ajax Experience: State Of The Browsers
The Ajax Experience: State Of The BrowsersThe Ajax Experience: State Of The Browsers
The Ajax Experience: State Of The Browsers
 
An Event Apart Boston: Principles of Unobtrusive JavaScript
An Event Apart Boston: Principles of Unobtrusive JavaScriptAn Event Apart Boston: Principles of Unobtrusive JavaScript
An Event Apart Boston: Principles of Unobtrusive JavaScript
 
Google presentation: The Open Web goes mobile
Google presentation: The Open Web goes mobileGoogle presentation: The Open Web goes mobile
Google presentation: The Open Web goes mobile
 
Yahoo presentation: JavaScript Events
Yahoo presentation: JavaScript EventsYahoo presentation: JavaScript Events
Yahoo presentation: JavaScript Events
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

The touch events - WebExpo

  • 1. Hell is other browsers - Sartre The touch events Peter-Paul Koch (ppk) http://quirksmode.org http://twitter.com/ppk WebExpo, 24 September 2010
  • 2. The desktop web Boring! - Only five browsers - with only one viewport each - that support nearly everything - Even IE? Yes, even IE.
  • 3.
  • 4. The Mobile Web Exciting! - Fifteen browsers and counting - ranging from great to lousy - Interesting new bugs - About five times as many users as the desktop web (eventually) - New interaction modes
  • 5. The Mobile Web Exciting! - Fifteen browsers and counting - ranging from great to lousy - Interesting new bugs - About five times as many users as the desktop web (eventually) - New interaction modes
  • 6. Mobile browsers - Android WebKit - NetFront - Opera Mobile - Bolt - Dolfin (bada) - UCWeb - Safari - Obigo - MicroB - Fennec - BlackBerry WebKit - Opera Mini - Symbian WebKit - IE Mobile - Palm WebKit You may groan now.
  • 7. Mobile browsers - Android WebKit - NetFront - Opera Mobile - Bolt - Dolfin (bada) - UCWeb - Safari - Obigo - MicroB - Fennec - BlackBerry WebKit - Opera Mini - Symbian WebKit - IE Mobile - Palm WebKit These are all WebKit-based.
  • 8. WebKit Mobile There is no WebKit on Mobile. There's iPhone Safari (3 and 4), and Android (1.6 and 2.1 and 2.2) and Symbian WebKit (1 and 2) and Blackberry WebKit and Palm WebKit and Dolfin for bada These WebKits are all different.
  • 9. There is no WebKit on Mobile. http://quirksmode.org/webkit.html
  • 10. Mobile web dev Focus on (in roughly this order) - iPhone - Android - BlackBerry (WebKit and old) - Symbian WebKit - Opera Mini - Opera Mobile - Dolfin (bada)
  • 11. Mobile web dev Focus on (in roughly this order) - iPhone - Android - BlackBerry (WebKit and old) - Symbian WebKit - Opera Mini - Opera Mobile - Dolfin (bada)
  • 12. Opera Mobile and Mini Opera Mobile is a normal browser. Request HTML, CSS, and JavaScript, interpret and execute them. Opera Mini, though, sends your request to a special server, which requests the HTML, CSS, and JS then interprets it and sends back basically a bitmap
  • 13. Opera Mini Opera Mini advantages: - Little memory necessary, works on old phones, too. - Less network traffic: you receive a highly compressed bitmap
  • 14. Opera Mini Opera Mini disadvantage: - No client-side interactivity. If a click event fires, Opera Mini goes back to the server to ask for instructions Tradeoff: lose client-side interactivity, but spend less money on devices and network connections.
  • 15. Mobile web dev Focus on (in roughly this order) - iPhone - Android - BlackBerry (WebKit and old) - Symbian WebKit - Opera Mini - Opera Mobile - Dolfin (bada)
  • 16. Mobile web dev Get real devices to test on. - iPhone or Android - Nokia S60 - BlackBerry (older) - Windows Mobile (useful secondary test platform) Yes, that's expensive. It's also necessary.
  • 17. Mobile web dev Get real devices to test on. - Unlocked! You should test with multiple networks - or with wifi
  • 18. Mobile web dev Use testing services: http://www.deviceanywhere.com/ http://perfectomobile.com/ Or use an emulator. Most mobile phone vendors offer one. Drawback: you can't hold them in your hand, and that's crucial for mobile.
  • 19. The Mobile Web Exciting! - Fifteen browsers and counting - ranging from great to lousy - Interesting new bugs - About five times as many users as the desktop web (eventually) - New interaction modes
  • 20. Before we start please open the following link on your phone: http://quirksmode.org/touchevents It gives links to the test files. The touch tests only work on iPhone, Android, bada, and BlackBerry Torch.
  • 21. Mouse
  • 24. Keyboard users need different Mouse interaction than mouse users need different interactions than touch users. Your script accomodates all three modes, right? It's all a question of events.
  • 28. It's not an either-or proposition.
  • 29. It's not an either-or proposition. The Nokia E71 has a four-way navigation. Works like the arrow keys (including keycodes). But...
  • 30. It's not an either-or proposition. But... the “arrow keys” steer a mouse cursor. Key events and mouse events
  • 31. Today we'll concentrate on the touch events, though.
  • 32. http://quirksmode.org/touchevents Open the first dropdown example. Task: Click on option 3.2 This is with traditional mouseover and mouseout; no touch-specific code. Works (a bit oddly, but works).
  • 33. In theory a touchscreen device should fire only the touch events, and not the mouse events. A touchscreen device doesn't have a mouse, after all. However, too many websites depend on the mouse events, so touch browser vendors are forced to support them, too.
  • 34. Touch !== mouse - Area - Pressure - Temperature - more than one touch
  • 35. http://quirksmode.org/touchevents Now open the second dropdown example. Task: Click on option 3.2 Doesn't work.
  • 36. Not an entirely fair comparison. Touchstart and touchend are not the equivalents of mouseover and mouseout. In fact, true hovering is impossible on touchscreens. There is no way of saying “I might be interested in this element but I'm not sure yet.”
  • 37. Interaction modes Mouse Keyboard Touch mousedown keydown touchstart mousemove keypress touchmove mouseup keyup touchend mouseover focus - mouseout blur - All All iPhone, Android, bada, BlackBerry
  • 38. Interaction modes Mouse Keyboard Touch mousedown keydown touchstart mousemove keypress touchmove mouseup keyup touchend mouseover focus - mouseout blur - load, unload, click, submit, resize, zoom, change etc. etc.
  • 39. Interaction modes Mouse Keyboard Touch mousedown keydown touchstart mousemove keypress touchmove mouseup keyup touchend mouseover focus - mouseout blur - load, unload, click, submit, resize, zoom, change etc. etc.
  • 40. Interaction modes Mouse Keyboard Touch mousedown keydown touchstart mousemove keypress touchmove mouseup keyup touchend mouseover focus - mouseout blur - load, unload, click, submit, resize, zoom, change etc. etc.
  • 41. Interaction modes Mouse Keyboard Touch mousedown keydown touchstart mousemove keypress touchmove mouseup keyup touchend mouseover focus - mouseout blur - load, unload, click, submit, resize, zoom, change etc. etc.
  • 42. When you touch the screen of a touchscreen, both touch and mouse events fire. But the mouse events are a bit special. They all fire at the same time. http://quirksmode.org/touchevents You can test the events for yourself at the touch action test page.
  • 44. Once started, the touch events keep firing regardless of where your finger is. element.ontouchmove = function () { // do stuff } This event handler continues firing even if your finger leaves the element. We need touchenter and touchleave events for when finger enters or leaves element.
  • 45. touchstart If a DOM change occurs mouseover onmouseover or mousemove onmousemove, the rest mousedown of the events is cancelled. mouseup (iPhone and Symbian) click :hover styles applied
  • 46. When the user touches another element mouseout :hover styles removed
  • 47. http://quirksmode.org/touchevents Try the Event Delegation page. Touch the bordered div. document.onclick = function () { // change divs } You click on a div, not on the document. Still, the event bubbles up. Except on the iPhone.
  • 48. The iPhone does not register a click event if the element you click on doesn't have a click event handler. document.onclick = function () { // change divs } div.onclick = function () {} Now the div itself has a click event handler, and event delegation works fine.
  • 49. http://quirksmode.org/touchevents Now open the first drag-and-drop example. Should work fine; both on touch devices and with a mouse. This is very simple.
  • 50. Mouse and touch events: element.ontouchstart = function (e) { element.ontouchmove = function (e) {etc} element.ontouchend = function (e) {etc} } element.onmousedown = function (e) { document.onmousemove = function (e) {etc} document.onmouseup = function (e) {etc} }
  • 51. Mouse and touch events: element.ontouchstart = function (e) { element.ontouchmove = function (e) {etc} element.ontouchend = function (e) {etc} element.onmousedown = null; } element.onmousedown = function (e) { document.onmousemove = function (e) {etc} document.onmouseup = function (e) {etc} } But how do you know whether to use the mouse or the touch events?
  • 52. http://quirksmode.org/touchevents Now open the second drag-and-drop example. iPhone only. Try dragging two or all three layers simultaneously. (A bit stilted, but you get the point.)
  • 53. This is impossible on a desktop computer. Two mice? Useful for games, maybe (especially on the iPad). Does not work on other browsers: they don't (yet) support true multitouch.
  • 54. http://quirksmode.org/touchevents Now open the scrolling layer example. Works fine – on mobile. But how do we port this to the other interaction modes? - keys: use arrow keys - mouse: ???
  • 55. Interaction modes - mouse - keyboard - touch - and a fourth....
  • 56. Interaction modes - mouse - keyboard - touch - trackball Generally fires a mousemove event
  • 57. Thank you! Questions? http://quirksmode.org http://twitter.com/ppk I'll post these slides on my site.