Skip to content

Commit 3e83fb6

Browse files
committed
fix(material/slider): handle contextmenu events
fixes issue #27225
1 parent 2f992e9 commit 3e83fb6

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/material/slider/slider-input.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,13 +269,15 @@ export class MatSliderThumb implements _MatSliderThumb, OnDestroy, ControlValueA
269269
this._hostElement.addEventListener('pointerdown', this._onPointerDown.bind(this));
270270
this._hostElement.addEventListener('pointermove', this._onPointerMove.bind(this));
271271
this._hostElement.addEventListener('pointerup', this._onPointerUp.bind(this));
272+
this._hostElement.addEventListener('contextmenu', this._onPointerUp.bind(this));
272273
});
273274
}
274275

275276
ngOnDestroy(): void {
276277
this._hostElement.removeEventListener('pointerdown', this._onPointerDown);
277278
this._hostElement.removeEventListener('pointermove', this._onPointerMove);
278279
this._hostElement.removeEventListener('pointerup', this._onPointerUp);
280+
this._hostElement.removeEventListener('contextmenu', this._onPointerUp);
279281
this._destroyed.next();
280282
this._destroyed.complete();
281283
this.dragStart.complete();

src/material/slider/slider-thumb.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export class MatSliderVisualThumb implements _MatSliderVisualThumb, AfterViewIni
118118
input.addEventListener('pointerleave', this._onMouseLeave);
119119
input.addEventListener('focus', this._onFocus);
120120
input.addEventListener('blur', this._onBlur);
121+
input.addEventListener('contextmenu', this._onDragEnd);
121122
});
122123
}
123124

@@ -129,6 +130,7 @@ export class MatSliderVisualThumb implements _MatSliderVisualThumb, AfterViewIni
129130
input.removeEventListener('pointerleave', this._onMouseLeave);
130131
input.removeEventListener('focus', this._onFocus);
131132
input.removeEventListener('blur', this._onBlur);
133+
input.removeEventListener('contextmenu', this._onDragEnd);
132134
}
133135

134136
private _onPointerMove = (event: PointerEvent): void => {

0 commit comments

Comments
 (0)