-
Notifications
You must be signed in to change notification settings - Fork 2k
feat(number input): added a prop to disable the wheel functionality #12358
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
feat(number input): added a prop to disable the wheel functionality #12358
Conversation
|
DCO Assistant Lite bot All contributors have signed the DCO. |
✅ Deploy Preview for carbon-elements ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for carbon-components-react ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
|
I have read the DCO document and I hereby sign the DCO. |
|
@mgueyraud Looks like one of the tests is failing. From the root of the carbon folder in your dev environment, run |
|
Hey @sstrubberg, thank you very much!. I already did the commit, hope it works. |
tay1orjones
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for putting this together! Based on the original issue, this is a bit off mark from what was discussed.
- The wheel event should only be disabled when the input has focus.
- The input should not be blurred.
- The
onWheelevent can not be used due to limitations with React described in the original issue.
On focus of the input, a manual event handler needs to be applied to the input element that calls evt.preventDefault(); when fired. This manual handler should be removed on blur of the input.
|
Hey @tay1orjones , changed the approach as you said, let me know if it's good. |
|
Ok, now I think you need to run |
|
Hey @sstrubberg , I did as you said but it seems it's not something from formatting, if you check the action it looks like it didn't install the dependencies correctly. |
|
@mgueyraud, have you pulled the latest changes from |
|
@tw15egan , did the merge and added me as a contributor also. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Wheel events do not change the value of the input when the input is focused and the pointer is hovered over the current value. There is no change when the input is not focused.
wheel.event.properly.disabled.mov
Thanks so much for the contribution! 🎉
It would be nice if there was a test to cover this functionality, but it's not totally necessary here for this contribution. We'd probably have to use fireEvent() instead of something from user-event. user-event doesn't support wheel/scroll events.
tw15egan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for contributing! 🎉 ✅ 👍🏻
|
This PR currently has a merge conflict. Please resolve this and then re-add the |
|
@mgueyraud Looks like there are some merge conflicts, once these are fixed we're good to go 👍🏻 |
|
Hey @tw15egan , did the merge and resolved the conflicts! |
|
Hey there! v11.16.0 was just released that references this issue/PR. |
Closes #11982
Added a prop to disable the wheel functionality that inputs with type number have.
Changelog
New