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

NumericInput doesn't respond to continuous mouse down input #2146

Closed
kaiyoma opened this issue Feb 16, 2018 · 2 comments
Closed

NumericInput doesn't respond to continuous mouse down input #2146

kaiyoma opened this issue Feb 16, 2018 · 2 comments

Comments

@kaiyoma
Copy link

kaiyoma commented Feb 16, 2018

Bug report

  • Package version(s): 2.0.0-beta.3
  • Browser and OS versions: Chrome 64 on Windows 10

Steps to reproduce

Click the up/down arrow button for a NumericInput component and hold down the mouse button.

Actual behavior

Nothing happens until you release the mouse button.

Expected behavior

The value in the input should change rapidly while the mouse button is held down.

@giladgray
Copy link
Contributor

yes this feature is not implemented, but it would be sweet! happy to accept a PR. IIRC, one of the DOM key events (down or press) will fire continuously when held so we can just use that.

@giladgray
Copy link
Contributor

oh my comment was about holding the keys, sorry. there's no such continuous event for the mouse, so we'd have to implement it manually with a flag and interval timer 😢

reiv added a commit to reiv/blueprint that referenced this issue Feb 22, 2018
giladgray pushed a commit that referenced this issue Mar 13, 2018
* [core] support continuous change in numeric input

Fixes #2146

* simulate button press using "mousedown"

* simulate button press using "mousedown"

* Incorporate requested changes

* Reduce continuous change interval to 100ms
* Use setInterval() for the continuous change handler
* Add and use updateDelta() instead of setting this.delta directly
* Add and use startContinousChange() and stopContinousChange()

* Fix typo

* More refactoring

* Add a comment about wrapping setInterval() in setTimeout()
* updateDelta() computes the delta itself using direction and event
* Replace getIncrementDelta() calls with updateDelta()
* Remove handleButtonKeyDown()

* More refactoring

* Remove handleMouseUp() in favor of stopContinuousChange()
* Reset delta in stopContinuousChange()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants