Skip to content

Commit 4160f11

Browse files
authored
fix(material-experimental/mdc-slider): append class to indicate short value indicator text (#23566)
* This class is only used internally. It is a temporary fix which will be removed once the appending of this class is handled by the mdc foundation (cl/388828896).
1 parent ef4fc56 commit 4160f11

File tree

1 file changed

+9
-0
lines changed
  • src/material-experimental/mdc-slider

1 file changed

+9
-0
lines changed

src/material-experimental/mdc-slider/slider.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ export interface MatSliderDragEvent {
8080
styleUrls: ['slider-thumb.css'],
8181
host: {
8282
'class': 'mdc-slider__thumb mat-mdc-slider-visual-thumb',
83+
84+
// NOTE: This class is used internally.
85+
// TODO(wagnermaciel): Remove this once it is handled by the mdc foundation (cl/388828896).
86+
'[class.mdc-slider__thumb--short-value]': '_isShortValue()',
8387
},
8488
changeDetection: ChangeDetectionStrategy.OnPush,
8589
encapsulation: ViewEncapsulation.None,
@@ -150,6 +154,11 @@ export class MatSliderVisualThumb implements AfterViewInit, OnDestroy {
150154
this._elementRef.nativeElement.removeEventListener('mouseleave', this._onMouseLeave);
151155
}
152156

157+
/** Used to append a class to indicate when the value indicator text is short. */
158+
_isShortValue(): boolean {
159+
return this.valueIndicatorText?.length <= 2;
160+
}
161+
153162
private _onMouseEnter = (): void => {
154163
this._isHovered = true;
155164
// We don't want to show the hover ripple on top of the focus ripple.

0 commit comments

Comments
 (0)