Skip to content

Touch events: example does not work in modern browsers #40532

@generalmimon

Description

@generalmimon

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/Touch_events

What specific section or headline is this issue about?

Example

What information was incorrect, unhelpful, or incomplete?

The interactive example in https://developer.mozilla.org/en-US/docs/Web/API/Touch_events#result is completely broken in modern browsers (tested in Google Chrome 138.0.7204.169 and Firefox Developer Edition 142.0b2 (64-bit) on Windows 10.0.19045, and also in Chrome 138.0.7204.168 on a physical Android 15 phone). When initiating a touch above the canvas, the "Log" <pre> element just fills up with error messages as follows, and the <canvas> element remains blank:

can't figure out which touch to end 
touchend 
can't figure out which touch to continue 
can't figure out which touch to continue 
can't figure out which touch to continue 
can't figure out which touch to continue 
touchstart. 
Initialized. 

The following error messages appear in DevTools' console:

  • Google Chrome 138.0.7204.169 (Official Build) (64-bit)

    TypeError: touches.entries is not a function or its return value is not iterable
        at HTMLCanvasElement.handleStart (runner.html?state=3V…j%2BBg%3D%3D:138:36)
    runner.html?state=3V…DVIGj%2BBg%3D%3D:96
    
  • Firefox Developer Edition 142.0b2 (64-bit)

    TypeError: touches.entries is not a function
        handleStart https://(...).mdnplay.dev/en-US/docs/Web/API/Touch_events/runner.html?state=(...):138
    runner.html:96:31
    

What did you expect to see?

I expect something to be drawn on the canvas in response to the touch events, as seen in the screenshots in #13590 (comment).

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

No response

MDN metadata

Page report details

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions