Skip to content

bug(mat-slider): Multi touch doesn't work as expected #22614

Closed
@puschkin

Description

@puschkin

I'm trying to place several mat-sliders next to each other and be able to adjust them with multi-touch.

Problem is that, as soon as I start dragging a second fader, the fader gets the values of the other fader.

Reproduction

Use StackBlitz to reproduce your issue:

Steps to reproduce:

  1. open application (stackblitz, link see above) on a multi-touch enabled device, e.g. smartphone (I tried with android / chrome and on a multi touch screen on linux /chrome + firefox)
  2. move first slider by touching it. don't lift the finger
  3. move the second slider by touching it, also don't lift the finger

Expected Behavior

The value of the slider is adjusted independently

Actual Behavior

The second slider always has the same value as the first slider.

Environment

  • Angular: 11.2.11
  • CDK/Material: 11.2.11
  • Browser(s): Chrome, Firefox
  • Operating System (e.g. Windows, macOS, Ubuntu): ArchLinux, Android

Investigation

I already figured out why this bug appears and made an attempt to fix it - which seems to work - at least in my use case.

The problem is, that on the touch events, there is no distinction if the event is for this particular fader or not.
With my PR, I'm adding a filter before those events and only choose the targetTouch that is relevant for that fader.

Here is the Pull request (first only against my own fork)
https://github.com/puschkin/components/pull/1

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/slider

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions