fix(material/input): Number input not changing on wheel interaction#29449
fix(material/input): Number input not changing on wheel interaction#29449crisbeto merged 1 commit intoangular:mainfrom ChristophWieske:fixing-number-input-wheel-handling
Conversation
|
Tried to add a test as well, but wasn´t able to trigger the inputs default wheel behavior with dispatched events. I assume it only works with trusted events. Added a section to the dev app that shows the scenario that triggered the issue (number input + tooltip). |
src/material/input/input.ts
Outdated
| // 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. | ||
| if ( |
There was a problem hiding this comment.
Consider moving this out into a private method since the setter is getting pretty big.
src/material/input/input.ts
Outdated
| this._type === 'number' && | ||
| (this._platform.BLINK || this._platform.WEBKIT) | ||
| ) { | ||
| this._elementRef.nativeElement.addEventListener('wheel', this._WebkitBlinkWheelListener); |
There was a problem hiding this comment.
Should we bind this outside the NgZone?
src/material/input/input.ts
Outdated
| } | ||
| }; | ||
|
|
||
| private _WebkitBlinkWheelListener = (): void => { |
There was a problem hiding this comment.
The naming of this will likely trigger a lint warning.
|
@crisbeto I applied your feedback and fixed linter errors. Have a look. |
|
@ChristophWieske you need to run |
In blink and webkit browsers the default behavior of increasing or decreasing a focused number input on wheel events is broken until a wheel event listener is explicitly added. Fixes #29074
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
In blink and webkit browsers the default behavior of increasing or decreasing a focused number input on wheel events is broken until a wheel event listener is explicitly added.
Fixes #29074