question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[UX Improvement] Disable mouse wheel behavior on number type inputs

See original GitHub issue

There is annoying behaviour that should not exist IMHO for UX’s sake: when you scroll on an <input type="number"> you can change input when you have the focus on it which is not user-friendly at all since the mouse wheel is almost exclusively used for scrolling page. As a result, people are typing a value, then trying to scroll further for another input and then changing the input value without even noticing for the majority.

I don’t know what is implemented in React that changes how it is handled in most browsers. I have tried to track down the event which is modifying the input without success. But if you try vanilla javascript in, let’s say, Chrome then you don’t have this ugly behaviour. 🤷‍♂️

For illustration purposes:

Another reference: https://stackoverflow.com/questions/68260072/why-can-we-update-a-value-of-a-number-input-using-mouse-wheel

Can someone explain why and where in the code wheel is changing the input? Or why it is not like that in vanilla JS (for most browsers)?

And maybe deciding to change the default behaviour to something more user-friendly could be discussed?

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:4
  • Comments:10

github_iconTop GitHub Comments

2reactions
vvscodecommented, Aug 29, 2022

I want to mention, that react rendering affects also inputs that are draw outside the React component.

https://codesandbox.io/s/wheel-problem-5nz2b5?file=/src/index.js:110-282

1reaction
Jule-commented, Aug 29, 2022

@vvscode indeed, as exposed in my first codesandbox, but I forgot to mention it clearly. Thanks for mentioning that annoying side effect!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I prevent the mousewheel from incrementing and ...
Numeric input fields are incremented or decremented if the mouse wheel is used when the cursor is on the field.
Read more >
Disable scrolling on `<input type=number>` in React
Is it possible to disable the scroll wheel changing the number in an input number field? I removed spinner arrows using CSS but...
Read more >
SAPUI5 input type number disable mouse wheel scroll?
Hi All, I want to disable mouse wheel scroll, because when I scroll the mouse wheel up and down input type number field...
Read more >
Designing Better Inline Validation UX - Smashing Magazine
We validate input as users type, and so as people move from one green checkmark to another, we boost their confidence and create...
Read more >
UI cheat sheet: text fields - UX Collective
The default or active state is when you haven't clicked an input field and it is ready and waiting for action. An input...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found