Skip to content

Commit 747218b

Browse files
committed
fix(material/input): revert wheel workaround (#31391)
Reverts the workaround from #29074, because it appears to make the behavior inconsistent between browsers and users don't have an easy way to opt out. Instead of adding the event from Material, users that care about this behavior can add a `wheel` event themselves. Fixes #31372. (cherry picked from commit 663d816)
1 parent e89c09b commit 747218b

File tree

1 file changed

+0
-32
lines changed

1 file changed

+0
-32
lines changed

src/material/input/input.ts

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ export class MatInput
214214
return this._type;
215215
}
216216
set type(value: string) {
217-
const prevType = this._type;
218217
this._type = value || 'text';
219218
this._validateType();
220219

@@ -224,10 +223,6 @@ export class MatInput
224223
if (!this._isTextarea && getSupportedInputTypes().has(this._type)) {
225224
(this._elementRef.nativeElement as HTMLInputElement).type = this._type;
226225
}
227-
228-
if (this._type !== prevType) {
229-
this._ensureWheelDefaultBehavior();
230-
}
231226
}
232227
protected _type = 'text';
233228

@@ -610,33 +605,6 @@ export class MatInput
610605
}
611606
};
612607

613-
private _webkitBlinkWheelListener = (): void => {
614-
// This is a noop function and is used to enable mouse wheel input
615-
// on number inputs
616-
// on blink and webkit browsers.
617-
};
618-
619-
/**
620-
* In blink and webkit browsers a focused number input does not increment or decrement its value
621-
* on mouse wheel interaction unless a wheel event listener is attached to it or one of its
622-
* ancestors or a passive wheel listener is attached somewhere in the DOM. For example: Hitting
623-
* a tooltip once enables the mouse wheel input for all number inputs as long as it exists. In
624-
* order to get reliable and intuitive behavior we apply a wheel event on our own thus making
625-
* sure increment and decrement by mouse wheel works every time.
626-
* @docs-private
627-
*/
628-
private _ensureWheelDefaultBehavior(): void {
629-
this._cleanupWebkitWheel?.();
630-
631-
if (this._type === 'number' && (this._platform.BLINK || this._platform.WEBKIT)) {
632-
this._cleanupWebkitWheel = this._renderer.listen(
633-
this._elementRef.nativeElement,
634-
'wheel',
635-
this._webkitBlinkWheelListener,
636-
);
637-
}
638-
}
639-
640608
/** Gets the value to set on the `readonly` attribute. */
641609
protected _getReadonlyAttribute(): string | null {
642610
if (this._isNativeSelect) {

0 commit comments

Comments
 (0)