Skip to content
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

Wheel scroll behavior for NumberField is inverted on Windows #4196

Closed
asyncore opened this issue Mar 14, 2023 · 2 comments
Closed

Wheel scroll behavior for NumberField is inverted on Windows #4196

asyncore opened this issue Mar 14, 2023 · 2 comments

Comments

@asyncore
Copy link

asyncore commented Mar 14, 2023

🐛 Bug Report

When a NumberField is active, scrolling down via the mouse wheel triggers the increment behavior, and scrolling up via the mouse wheel triggers the decrement behavior on Windows. On MacOS this could make sense as the scroll direction is inverted, but it's pretty counter-intuitive on Windows.

🤔 Expected Behavior

Scrolling up via the mouse wheel should increment the value, and scrolling down via the should decrement the value in the NumberField on Windows.

😯 Current Behavior

Scrolling up via the mouse wheel decrements the value, and scrolling down via the increments the value in the NumberField on Windows.

💁 Possible Solution

The behavior is defined in

.

Perhaps, based on the window.navigator.userAgent,
For Mac platforms, the current behavior could be kept (e.deltaY > 0 => increment())
and for the other platforms (e.deltaY < 0 => increment())

Alternatively, the behavior can be inverted based on a flag in the NumberField or NumberFieldState props, so the caller would be in control.

🔦 Context

As a Windows user, I'm used to things going down when I scroll down, and going up when I scroll up.

💻 Code Sample

🌍 Your Environment

Software Version(s)
react-spectrum 3.17
Browser Chrome
Operating System Windows

🧢 Your Company/Team

🕷 Tracking Issue (optional)

@reidbarber
Copy link
Member

If we implement this, we can use isMac() from @react-aria/utils. We would also want to do this in useColorField.

@devongovett
Copy link
Member

devongovett commented Mar 14, 2023

On my Mac, scrolling up increments, and scrolling down decrements. I just checked and the same thing happens on my Windows machine when using the trackpad. I don't have a hardware mouse to test with.

That said, in both cases it depends on an operating system setting that changes the scroll direction (in the Touchpad settings on Windows). We tried to match the default for this I believe. Unfortunately, browsers don't expose this setting so we cannot easily change our behavior based on it. You can find a Chromium bug here: https://bugs.chromium.org/p/chromium/issues/detail?id=156551 and a spec bug here: w3c/uievents#57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants