Skip to content

Commit 78807d0

Browse files
committed
fix(material/slider): add cancelable checks to touchmove and touchend events (#25301)
Adds checks to ensure that `touchmove` and `touchend` events are cancelable before we call `preventDefault` on them. Fixes #25272. (cherry picked from commit c4da9c0)
1 parent dbd1f26 commit 78807d0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/material/slider/slider.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,9 @@ export class MatSlider
704704

705705
if (pointerPosition) {
706706
// Prevent the slide from selecting anything else.
707-
event.preventDefault();
707+
if (event.cancelable) {
708+
event.preventDefault();
709+
}
708710
const oldValue = this.value;
709711
this._lastPointerEvent = event;
710712
this._updateValueFromPosition(pointerPosition);
@@ -727,7 +729,9 @@ export class MatSlider
727729
// seems like in most cases `touches` is empty for `touchend` events.
728730
findMatchingTouch(event.changedTouches, this._touchId)
729731
) {
730-
event.preventDefault();
732+
if (event.cancelable) {
733+
event.preventDefault();
734+
}
731735
this._removeGlobalEvents();
732736
this._isSliding = null;
733737
this._touchId = undefined;

0 commit comments

Comments
 (0)