-
-
Notifications
You must be signed in to change notification settings - Fork 145
Rework on Input #580
Rework on Input #580
Conversation
feedback is welcome before I'm adding a few test cases for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the change enables the user to enter a negative number easily, I'm wondering if we are breaking an expectation in terms of API. When entering 1
or 1.4
in master the value in the callback is an int
and a float
respectively. With the change it's always a string
.
The original issue comments is more debounce
centric but does offer some comments about number vs string. #169
Current value proptype
Previous value proptype
Seems reasonable to want to continue providing the extra value of the cast when possible, if type=number
.
Maybe we can use a state.value
with the actual string and update props.value
after a validation/cast to keep this behavior?
The HTML input does always have string
as type of value.
Agreed - the prop value should be a number. Interestingly, playing with it now in Chrome, the browser does character filtering to the set I'd propose we allow the user to type whatever they want, and have separate focused and blurred behavior:
So here are two cases to consider
Seem reasonable? |
Looking at the code, this component is a bit weird at the moment. There's 3 scenarios where we
🐛 Separate bug to fix the min/max check -- whether we fix it at the same time or not is up to us.
|
yes, I don't feel the clearing input while
|
@byronz By |
debounce => Falsedebounce => True@alexcjohnson @Marc-Andre-Rivet please review the improved error handling behavior with numbers take note that browsers have different native behavior for
the current solution will have a harmonized effect similar to native firefox validation |
The behavior seems inconsistent between Firefox and (Chrome + Safari) when entering an invalid value — in Firefox the value stays in the input while in the other two the value becomes blank. In all cases the default behavior of the html field is to retain the value. I think this is a side-effect of the implementation causing |
@byronz From our previous discussion and using the code you gave me, here's the behavior I'm seeing in Chrome (top) and Firefox (bottom). Notice that Chrome clears the input while Firefox does not. I am using
|
this is another approach by hijacking the number type inside the the problem I see:
@Marc-Andre-Rivet @alexcjohnson I feel the native number input might be a better compromise for the time being. |
This reverts commit e08b46a.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Undo commits for the Python and R build artifacts and we're good to go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💃 🕺
this fixes both #455 and #513