Skip to content

Conversation

@mgueyraud
Copy link
Contributor

Closes #11982

Added a prop to disable the wheel functionality that inputs with type number have.

Changelog

New

  • Added a disableWheel prop in the component

@mgueyraud mgueyraud requested a review from a team as a code owner October 20, 2022 17:39
@github-actions
Copy link
Contributor

github-actions bot commented Oct 20, 2022

DCO Assistant Lite bot All contributors have signed the DCO.

@netlify
Copy link

netlify bot commented Oct 20, 2022

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit fb7b93b
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/635ae280b5e5c6000acdd34e
😎 Deploy Preview https://deploy-preview-12358--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Oct 20, 2022

Deploy Preview for carbon-components-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit fb7b93b
🔍 Latest deploy log https://app.netlify.com/sites/carbon-components-react/deploys/635ae280d0f89600086e59e1
😎 Deploy Preview https://deploy-preview-12358--carbon-components-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@mgueyraud
Copy link
Contributor Author

I have read the DCO document and I hereby sign the DCO.

@sstrubberg
Copy link
Member

@mgueyraud Looks like one of the tests is failing. From the root of the carbon folder in your dev environment, run yarn test packages/react/__tests__/PublicAPI-test.js -u. That should take care of it.

@mgueyraud mgueyraud requested a review from a team as a code owner October 21, 2022 16:41
@mgueyraud
Copy link
Contributor Author

Hey @sstrubberg, thank you very much!. I already did the commit, hope it works.

Copy link
Member

@tay1orjones tay1orjones left a 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 onWheel event 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.

@mgueyraud
Copy link
Contributor Author

Hey @tay1orjones , changed the approach as you said, let me know if it's good.

@mgueyraud mgueyraud requested review from tay1orjones and removed request for tw15egan October 21, 2022 18:04
@sstrubberg
Copy link
Member

Ok, now I think you need to run yarn format or yarn format:diff to fix the next error :)

@sstrubberg sstrubberg added the status: needs tests PRs that need tests label Oct 21, 2022
@mgueyraud
Copy link
Contributor Author

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.

@tw15egan
Copy link
Contributor

@mgueyraud, have you pulled the latest changes from main and run yarn? May need to run yarn build afterward, there have been a few PRs merged this afternoon. Afterward, you can run yarn test -u if any snapshots still need updating.

@mgueyraud
Copy link
Contributor Author

mgueyraud commented Oct 21, 2022

@tw15egan , did the merge and added me as a contributor also.

@sstrubberg sstrubberg removed the status: needs tests PRs that need tests label Oct 21, 2022
Copy link
Member

@tay1orjones tay1orjones left a 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.

Copy link
Contributor

@tw15egan tw15egan left a 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! 🎉 ✅ 👍🏻

@kodiakhq
Copy link
Contributor

kodiakhq bot commented Oct 27, 2022

This PR currently has a merge conflict. Please resolve this and then re-add the status: ready to merge 🎉 label.

@tw15egan
Copy link
Contributor

@mgueyraud Looks like there are some merge conflicts, once these are fixed we're good to go 👍🏻

@mgueyraud
Copy link
Contributor Author

Hey @tw15egan , did the merge and resolved the conflicts!

@kodiakhq kodiakhq bot merged commit 1b78794 into carbon-design-system:main Oct 27, 2022
@carbon-bot
Copy link
Contributor

Hey there! v11.16.0 was just released that references this issue/PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Provide an easy way to disable wheel events in NumberInput

5 participants