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 requires min to be strictly less than max if both are defined #3294

Closed
n1313 opened this issue Jan 18, 2019 · 5 comments
Closed

Comments

@n1313
Copy link
Contributor

n1313 commented Jan 18, 2019

Environment

@blueprintjs/core: 3.10.0
Firefox 64.0.2, MacOS

Context

I have a Pagination component that uses NumericInput to display the current page number. My intention is to let users manually input their target page number to navigate directly to it, without having to click "next page" button many times. I am using min and max props to prevent users from entering wrong page numbers using "increment/decrement" buttons. Sometimes, I only have one page to display, which means that the only valid value for the input is "1". This makes NumericInput throw an error.

Steps to reproduce

<NumericInput min={1} max={1} />

Actual behavior

Component throws an error "Error: [Blueprint] requires min to be strictly less than max if both are defined." and is not rendered.

Expected behavior

Component is rendered and allows min and max values to be equal.

Possible solutions

  1. Remove the restriction from NumericInput by allowing min to be equal to max.
  2. Document the restriction and provide recommended workaround for cases like mine.
@giladgray
Copy link
Contributor

@n1313 ah interesting. sure, it seems reasonable to change the condition to <= to allow min === max. interested in submitting a PR?

@giladgray
Copy link
Contributor

nevermind, i'm about to open a PR for this.

@n1313
Copy link
Contributor Author

n1313 commented Jan 21, 2019

Hi @giladgray, yes, I would like to contribute but I seem to be late to the party. Thank you for taking this issue!

@n1313
Copy link
Contributor Author

n1313 commented Feb 7, 2019

@giladgray when is this fix scheduled to be released? Thanks!

@giladgray
Copy link
Contributor

@n1313 tomorrow I believe

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