angular / components

Component infrastructure and Material Design components for Angular
https://material.angular.io
MIT License
24.32k stars 6.73k forks source link

bug(mat-slider): Range slider works incorrect when max and min the same #27620

Closed alex-matveev42 closed 1 year ago

alex-matveev42 commented 1 year ago

Is this a regression?

The previous version in which this bug was not present was

No response

Description

When user move Range slider from min point to max point or max point to min point(min equals max) user can't move points.

Reproduction

StackBlitz link: Steps to reproduce:

  1. go to https://material.angular.io/components/slider/examples
  2. move max point to min or min to max.
  3. You should get for example this state. image
  4. try to move point

Expected Behavior

user can easily move points

Actual Behavior

user can't move

Environment

wagnermaciel commented 1 year ago

I was unable to reproduce this. Are you setting the slider min & max equal to each other or just moving the slider thumbs together?

https://github.com/angular/components/assets/25158423/51343079-72c4-4a2f-91e9-5fcf515ab73f

brian-weasner commented 1 year ago

I can reproduce, but not sure if this is expected behavior.

When the slider dots are stacked, the left half of the slider dot allows for sliding the min point and the right half of the slider dot allows moving the max point.

alex-matveev42 commented 1 year ago

please take a look. this issue happens time to time. sometimes I can, sometimes I can't https://github.com/angular/components/assets/133750432/a52423d4-0454-4c70-ba7d-25dda1f987b9

brian-weasner commented 1 year ago

As I mentioned, it's dependent on what part of the stacked dot you select. image

Left side of stacked dots moves min, right side moves max.

This seems to be expected behavior, but I agree that it feels wrong when the dots are all the way to the left or the right sides of the slider.

alex-matveev42 commented 1 year ago

yes, it's feels wrong. because one point overlap another one. I change background-color and border-color for both(they totally different) and I can see that one point covered/overlapped second, so I would expect behavior like this - don't matter in which part of point you start moving - you can do this. So if min overlap max - I can move ONLY min and vice verse

wagnermaciel commented 1 year ago

I see. It seems like this can be handled by some special casing - if the slider thumbs are both set to the min or max value, make only one slider thumb selectable. I can probably take a look at this some time next week

alex-matveev42 commented 1 year ago

@wagnermaciel Did you have time to take a look of this issue?

wagnermaciel commented 1 year ago

Unfortunately no. My time lately has been split on css token work & fixing a dialog issue :/ If someone wants to take a stab at this, I believe it should just involve handling this edge case here:

https://github.com/angular/components/blob/main/src/material/slider/slider-input.ts#L726

angular-automatic-lock-bot[bot] commented 11 months ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.