Skip to content

feat(NumberField): support invertWheelChange to invert the wheel change behavior #1935

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

Merged
merged 3 commits into from
May 26, 2025

Conversation

kricsleo
Copy link
Collaborator

@kricsleo kricsleo commented May 24, 2025

resolves #1934

This PR "corrects" the wheel change behavior:

Before After
Scroll down (deltaY > 0) increase decrease
Scroll up (deltaY < 0) decrease increase

This is more intuitive, other UI libraries also do this, e.g., Material UI - TextField and Ant Design - InputNumber|

This PR adds support for invertWheelChange to invert the wheel change behavior.

Copy link

pkg-pr-new bot commented May 24, 2025

Open in StackBlitz

npm i https://pkg.pr.new/reka-ui@1935

commit: cc41c3a

@zernonia
Copy link
Member

I think it's debatable which direction is more intuitive 😂 The 'before' feels right to me tho..

Also, the current implementation is inspired by react-aria, hence having the same wheel behavior.

Perhaps we can have a props to invert the behavior, and allow user to modify it?

@kricsleo
Copy link
Collaborator Author

Yeah, it seems diverse in the community...

To me, "down" (deltaY > 0) aligns more with "decrease", while "up" (deltaY < 0) aligns more with "increase".

Since there's no specification for this, I agreed on adding invertWheelChange to satisfy both sides 👍.

As for the default behavior, we could temporarily leave it as is to avoid changes. It can be changed in the future if more users request it.

@kricsleo kricsleo changed the title fix(NumberField): correct wheel change behavior feat(NumberField): support invertWheelChange to invert the wheel change behavior May 26, 2025
Copy link
Member

@zernonia zernonia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🎉

@zernonia zernonia merged commit 9db3654 into unovue:v2 May 26, 2025
5 checks passed
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

Successfully merging this pull request may close these issues.

[Feature]: Invert wheel behavior property for NumberFieldRoot
2 participants