react-spectrum icon indicating copy to clipboard operation
react-spectrum copied to clipboard

[numberField] add option to disable increment/decrement on scroll

Open deebov opened this issue 5 years ago • 4 comments

🙋 Feature Request

It would be nice to have an option to disable increment/decrement on scroll for numberfield. There are many cases where these inputs are used for sensitive data like prices, percentages, etc., and when you have many number fields vertically stacked it's too easy to mess up (while scrolling). (Speaking from our own use case)

deebov avatar Feb 18 '21 10:02 deebov

Apparently Chrome's native number field only allows scrolling to adjust the value when focused. https://twitter.com/pipopeperoni/status/1362294961849384962?s=21 This makes a lot of sense to me. We could also have an option to disable it completely but I bet this would solve it by default for a lot of cases.

devongovett avatar Feb 18 '21 13:02 devongovett

I think it would be good to add an option to disable in/decrementing on scroll. If a focused NumberField scrolls into the cursor location, the user may end up accidentally in/decrementing the value.

aidan-keay avatar Oct 05 '21 14:10 aidan-keay

Hey! Since this was noted above, have you run into an issue where this is actually happening? We don't want to necessarily add this to the API if it doesn't solve a present problem and would cause it to no longer match the native behavior as it currently does. That's not saying we wouldn't consider it, just that we'd consider it carefully.

snowystinger avatar Oct 05 '21 22:10 snowystinger

Hey! Since this was noted above, have you run into an issue where this is actually happening? We don't want to necessarily add this to the API if it doesn't solve a present problem and would cause it to no longer match the native behavior as it currently does. That's not saying we wouldn't consider it, just that we'd consider it carefully.

Yes, a customer reported the issue to us. If it won't be added to the API, is there any way to override the behaviour? I tried overriding onScroll and onScrollCapture on the DOM element with an empty function to no avail.

aidan-keay avatar Oct 06 '21 00:10 aidan-keay