react-spectrum
39f0d780 - Fix #510: User is able to scroll one step above and below the NumberInput range limit in Chrome (#516)

Commit
6 years ago
Fix #510: User is able to scroll one step above and below the NumberInput range limit in Chrome (#516) Users should not be able to scroll above or below the specified range for NumberInput components. Users in Chrome are able to mouse wheel scroll one step above and below the specified range of a NumberInput component. See http://localhost:9002/?path=/story/numberinput--min-5-max-10-step-0-5 | Software | Version(s) | | ---------------- | ---------- | | react-spectrum | 2.22.0 | Browser | Chrome | Operating System | MacOS https://jira.corp.adobe.com/browse/RSP-1214 This relates to treating mouse wheel listeners as passive: https://www.chromestatus.com/feature/6662647093133312 In Chrome, we can no longer call preventDefault on a wheel event unless it explicitly added with {passive: false} option. Without preventDefault, two event handlers that increment/decrement the value of the number input are being called, handleInputScrollWheel and handleInputChange. The solution is to add the wheel event listener with passive: false option in componentDidMount rather than using onWheel prop on TextField.
Author
Michael Jordan
Committer
Parents
Loading