Skip to content

fix(material/input): revert wheel workaround #31391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions src/material/input/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ export class MatInput
return this._type;
}
set type(value: string) {
const prevType = this._type;
this._type = value || 'text';
this._validateType();

Expand All @@ -224,10 +223,6 @@ export class MatInput
if (!this._isTextarea && getSupportedInputTypes().has(this._type)) {
(this._elementRef.nativeElement as HTMLInputElement).type = this._type;
}

if (this._type !== prevType) {
this._ensureWheelDefaultBehavior();
}
}
protected _type = 'text';

Expand Down Expand Up @@ -610,33 +605,6 @@ export class MatInput
}
};

private _webkitBlinkWheelListener = (): void => {
// This is a noop function and is used to enable mouse wheel input
// on number inputs
// on blink and webkit browsers.
};

/**
* In blink and webkit browsers a focused number input does not increment or decrement its value
* on mouse wheel interaction unless a wheel event listener is attached to it or one of its
* ancestors or a passive wheel listener is attached somewhere in the DOM. For example: Hitting
* a tooltip once enables the mouse wheel input for all number inputs as long as it exists. In
* order to get reliable and intuitive behavior we apply a wheel event on our own thus making
* sure increment and decrement by mouse wheel works every time.
* @docs-private
*/
private _ensureWheelDefaultBehavior(): void {
this._cleanupWebkitWheel?.();

if (this._type === 'number' && (this._platform.BLINK || this._platform.WEBKIT)) {
this._cleanupWebkitWheel = this._renderer.listen(
this._elementRef.nativeElement,
'wheel',
this._webkitBlinkWheelListener,
);
}
}

/** Gets the value to set on the `readonly` attribute. */
protected _getReadonlyAttribute(): string | null {
if (this._isNativeSelect) {
Expand Down
Loading