Skip to content

Blockly broken on Firefox on desktop #6340

@rachel-fenichel

Description

@rachel-fenichel

Describe the bug

Blockly doesn't work on Firefox on desktop because TouchEvent is undefined. It throws "Uncaught ReferenceError: TouchEvent is not defined" from splitEventByTouches on event mouse move event.

To Reproduce

Check out develop
Run npm start
Open the playground in Firefox on desktop
Look at the console

Expected behavior

No console errors, and clicking works.

Screenshots

Stack Traces

Uncaught ReferenceError: TouchEvent is not defined
    splitEventByTouches http://127.0.0.1:8080/build/src/core/touch.js line 1058 > srcScript:246
    wrapFunc http://127.0.0.1:8080/build/src/core/browser_events.js line 1058 > srcScript:53
    conditionalBind http://127.0.0.1:8080/build/src/core/browser_events.js line 1058 > srcScript:73
    loadSounds http://127.0.0.1:8080/build/src/core/inject.js line 1058 > srcScript:322
    init http://127.0.0.1:8080/build/src/core/inject.js line 1058 > srcScript:223
    inject http://127.0.0.1:8080/build/src/core/inject.js line 1058 > srcScript:70
    start http://127.0.0.1:8080/tests/playground.html:38

Additional context

Probably caused by #6099 and not detected because we haven't done a release with full browser testing since then.

Not detected by generator tests running in Firefox because it depends on mouse interaction.

From the MDN page on Touch Events:

Touch events are typically available on devices with a touch screen, but many browsers make the touch events API unavailable on all desktop devices, even those with touch screens.

The reason for this is that some websites use the availability of parts of the touch events API as an indicator that the browser is running on a mobile device. If the touch events API is available, these websites will assume a mobile device and serve mobile-optimized content. This may then provide a poor experience for users of desktop devices that have touch screens.

To support both touch and mouse across all types of devices, use pointer events instead.

Found while trying to test #6336

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: touchinternalExternal contributions not acceptedissue: bugDescribes why the code or behaviour is wrong

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions