From 386f768b6c080077a7570ea4f759930641131f6e Mon Sep 17 00:00:00 2001 From: Wagner Maciel Date: Mon, 11 Mar 2024 15:52:26 +0000 Subject: [PATCH] fix(material/slider): fix animation issue (#28704) * the slider track animation would break in the case where a user clicks one thumb, tabs to the other, then uses an arrow key to change value. * for some reason, this bug only happens when the slider is not discrete. (cherry picked from commit 27cb9033b48fed40d4956e0178f0d80c17d25f9d) --- src/material/slider/slider-input.ts | 2 ++ src/material/slider/slider-interface.ts | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/material/slider/slider-input.ts b/src/material/slider/slider-input.ts index a735dd9ed169..18480d7a7070 100644 --- a/src/material/slider/slider-input.ts +++ b/src/material/slider/slider-input.ts @@ -340,6 +340,8 @@ export class MatSliderThumb implements _MatSliderThumb, OnDestroy, ControlValueA } _onFocus(): void { + this._slider._setTransition(false); + this._slider._updateTrackUI(this); this._setIsFocused(true); } diff --git a/src/material/slider/slider-interface.ts b/src/material/slider/slider-interface.ts index a26bd5329a86..de7c3feb1afd 100644 --- a/src/material/slider/slider-interface.ts +++ b/src/material/slider/slider-interface.ts @@ -142,6 +142,9 @@ export interface _MatSlider { /** Updates the stored slider dimensions using the current bounding client rect. */ _updateDimensions: () => void; + /** Updates the scale on the active portion of the track. */ + _updateTrackUI: (source: _MatSliderThumb) => void; + /** Used to set the transition duration for thumb and track animations. */ _setTransition: (withAnimation: boolean) => void;