Skip to content

bug(mat-slider): Max value not updating correctly when new value is 0 #23913

Closed
@YSFKBDY

Description

@YSFKBDY

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

I am changing slider's max value in my component while/after doing some works. And it seems it has a problem updating visually when new max value is 0.

Reproduction

Steps to reproduce:

  1. Define slider like this: <mat-slider min="0" [displayWith]="displayValue" [max]="maxValue" step="1" [thumbLabel]="true" [tickInterval]="1" [(ngModel)]="sliderValue" (ngModelChange)="changeSliderValue()"></mat-slider>
  2. Default sliderValue is 0, maxValue is 0.
  3. Click a button and change maxValue - let's say to 6. Updates slider and ticks correctly.
  4. Click another button and change maxValue to 0. Updates slider and ticks incorrectly, shows previous ticks.
  5. You can see the same bug here: https://material.angular.io/components/slider/examples

Expected Behavior

Updating slider and ticks correctly.

Actual Behavior

Updated slider and ticks incorrectly.

Environment

  • Angular: 10.2.0
  • CDK/Material: 11.0.2
  • Browser(s): Chome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows 10 x64

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: material/slidergood first issueThis issue is a good place to start for first time contributors to the projecthelp wantedThe team would appreciate a PR from the community to address this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions