Skip to content

Commit 6645b6e

Browse files
committed
fix(material-experimental/mdc-slider): append class to indicate short value indicator text
* 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 700b3c2 commit 6645b6e

File tree

1 file changed

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

1 file changed

+10
-0
lines changed

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

Lines changed: 10 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,12 @@ 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+
if (!this.valueIndicatorText) { return false; }
160+
return this.valueIndicatorText.length <= 2;
161+
}
162+
153163
private _onMouseEnter = (): void => {
154164
this._isHovered = true;
155165
// We don't want to show the hover ripple on top of the focus ripple.

0 commit comments

Comments
 (0)