Skip to content

NumericInput should not print a warning when the value is not within min, max or step constraints #7370

@stropitek

Description

@stropitek

I'm not sure if this falls into the feature request or bug category.

Related: #4327

Actual behavior

When we set a value (controlled input) on NumericInput, if the value is either out of the min / max range, or not a multiple of the step size, it prints the following warning to the console (on every render):

Warning

[Blueprint] <NumericInput> controlled value prop does not adhere to stepSize, min, and/or max constraints.

Expected behavior

I don't know the context in which the decision to print this warning was made.
But I would argue that if a user enters a value that is not correct:

  • It is not a developer mistake so should not trigger a console warning.
  • In order to create the conditions in which the warning never appears, we would need to override what the user typed automatically, which is arguably not good UX.
  • It is perfectly normal to go through an invalid value first in order to reach a valid value. Example: range is 10-30 and user enters 20. As they type the first character, the value will be outside of the range.

The warning would make sense for a slider where the user is constrained to the allowed values, but not for a free text input.

Steps to reproduce

This warning can easily be reproduced in the docs:
https://blueprintjs.com/docs/#core/components/numeric-input

If you enter a value out of the min / max range, the warning appears.

Possible solution

Remove the warning entirely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions