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

fix(number-input): spinner getting stuck in useNumberInput button props #4703

Closed
wants to merge 2 commits into from
Closed

fix(number-input): spinner getting stuck in useNumberInput button props #4703

wants to merge 2 commits into from

Conversation

xotea
Copy link

@xotea xotea commented Sep 10, 2021

Closes #4646

📝 Description

Using useNumberInput and setting a min and/or max value and a chakra <Button /> with getIncrementButtonProps or getDecrementButtonProps the spinner gets stuck if you reach the limit and move the mouse off the now disabled button while still holding left click in latest Chromium-based browsers. In Firefox it's fine.

🚀 New behavior

Adding an onPointerLeave event handler to the existing ones seems to fix the problem. This was also recommended in this React issue as a solution.

The onPointerUp handler is also needed if the mouse doesn't leave the button while editing the input field value.

💣 Is this a breaking change (Yes/No):

No

@changeset-bot
Copy link

changeset-bot bot commented Sep 10, 2021

⚠️ No Changeset found

Latest commit: 4b898d7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Sep 10, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

chakra-ui – ./

🔍 Inspect: https://vercel.com/chakra-ui/chakra-ui/FZvyqPZ9rqud1gNewMtyJQ4s9RoM
✅ Preview: https://chakra-ui-git-fork-xotea-fix-number-input-spinner-chakra-ui.vercel.app

chakra-ui-storybook – ./

🔍 Inspect: https://vercel.com/chakra-ui/chakra-ui-storybook/9EC34SnYUrinNFMrACv9UxHiQGxU
✅ Preview: https://chakra-ui-storybook-git-fork-xotea-fix-number-05587f-chakra-ui.vercel.app

@codesandbox-ci
Copy link

codesandbox-ci bot commented Sep 10, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 4b898d7:

Sandbox Source
create-react-app-ts Configuration
use-number-input-bug Issue #4646

@segunadebayo
Copy link
Member

Thanks for working on this @xotea.

I took some ideas from your PR and merged them into a single PR to address multiple number-input issues

See #4982

@xotea xotea deleted the fix/number-input-spinner branch November 3, 2021 11:48
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.

Holding decrement button on useNumberInput causes new inputs to count down to min value
2 participants