Skip to content

Commit 19fa9b8

Browse files
committed
fix(material/slider): make selecting thumbs at min/max easier (#27702)
fixes #27620 (cherry picked from commit eef4556)
1 parent 8d44900 commit 19fa9b8

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/material/slider/slider-input.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,19 @@ export class MatSliderRangeThumb extends MatSliderThumb implements _MatSliderRan
739739

740740
const percentage = this._slider.min < this._slider.max ? _percentage : 1;
741741

742-
const width = maxWidth * percentage + 24;
742+
// Extend the native input width by the radius of the ripple
743+
let ripplePadding = this._slider._rippleRadius;
744+
745+
// If one of the inputs is maximally sized (the value of both thumbs is
746+
// equal to the min or max), make that input take up all of the width and
747+
// make the other unselectable.
748+
if (percentage === 1) {
749+
ripplePadding = 48;
750+
} else if (percentage === 0) {
751+
ripplePadding = 0;
752+
}
753+
754+
const width = maxWidth * percentage + ripplePadding;
743755
this._hostElement.style.width = `${width}px`;
744756
this._hostElement.style.padding = '0px';
745757

0 commit comments

Comments
 (0)