Skip to content

[Slider] Sends incorrect event.target on touch event #24740

@tech-meppem

Description

@tech-meppem

Having a slider in a Swipeable Drawer throws "Failed to execute 'contains' on 'Node'", on mobile device and chrome mobile view.

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

When attempting to move the slider on mobile view, an error is thrown.

The error is in SwipeableDrawer.js, line 391:
if (open && !backdropRef.current.contains(event.target) && !paperRef.current.contains(event.target)) {

The problem is that event.target is not type 'Node', and is instead an object, like the following:

{
  name: undefined,
  value: 80
}

This only happens if a function has been passed to the onChange prop on the Slider component.

Expected Behavior 🤔

No error should be thrown, and event.target would be a node.

Steps to Reproduce 🕹

Forked from the "Swipeable Edge Drawer" demo:
https://codesandbox.io/s/swipeableedgedrawer-material-demo-forked-kxlvk?file=/demo.tsx
must be on using chrome dev tools, with the mobile view active (device toolbar), otherwise no error happens

Make sure to enable mobile view in chrome dev tools:
image

Context 🔦

Have a slider in the SwipeableDrawer Edge.

Your Environment 🌎

System:
    OS: Windows 10 10.0.18363
    CPU: (12) x64 AMD Ryzen 5 2600X Six-Core Processor
    Memory: 2.42 GB / 15.93 GB
  Binaries:
    Node: 14.13.1 - C:\Program Files\nodejs\node.EXE
    npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD
  Managers:
    Composer: 1.8.6 - C:\ProgramData\ComposerSetup\bin\composer.BAT
    pip2: 20.2.2 - C:\Program Files (x86)\Python27-18\Scripts\pip2.EXE
    pip3: 19.0.3 - C:\Program Files (x86)\Python37-32\Scripts\pip3.EXE
  Utilities:
    Git: 2.27.0.
  SDKs:
    Windows SDK:
      AllowDevelopmentWithoutDevLicense: Enabled
      AllowAllTrustedApps: Enabled
      Versions: 10.0.17763.0, 10.0.18362.0, 10.0.19041.0
  IDEs:
    VSCode: 1.52.1 - C:\Users\Netduma\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
    Visual Studio: 16.7.30621.155 (Visual Studio Community 2019)
  Languages:
    Bash: 4.4.20 - C:\Windows\system32\bash.EXE
    PHP: 7.3.7 - C:\PHP7\php.EXE
    Python: 2.7.18
  Browsers:
    Chrome: 88.0.4324.104
    Edge: Spartan (44.18362.449.0)
    Internet Explorer: 11.0.18362.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGreat for first contributions. Enable to learn the contribution process.scope: sliderChanges related to the slider.type: bugIt doesn't behave as expected.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions