-
Notifications
You must be signed in to change notification settings - Fork 112
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
null
initial values break number inputs
#894
Comments
@vsgoulart What version was this on? Can't replicate on master atm. Maybe a tasklist only issue? Maybe something fixed by accident. |
@Skaiir There's a problem with the issue the description, but the root cause of this is indeed on Tasklist (to reproduce we need to pass the value But investigating this highlights another potential issue on |
Well so the way this works, there's first and sanitation that runs on every field on start, and then there's validation. Number has also a special validation that checks for NaN. Yeah it's inconsistent, I think we should always just sanitize and report that sanitation happened. But as of now, we don't have any mechanism for reporting that, so we would just sanitize and forget about "NaN" entirely. Also text null should not parse to "null". @christian-konrad does that make sense to you? We have a ticket tracking sanitation reporting somewhere that we can get to some other time. |
Just wanted to be thorough here, I checked all the conversion behaviors I'm thinking we get rid of NaN, it's a very unique way of doing things compared to all the other components / types. Just sanitation should be enough. It may still make sense to display NaN in the number field when pasting in text into it, but then again there are better ways of doing this, like short toast notifications or something, and we don't know how frequent of a problem that is. I don't know, this can be discussed. Null for text entry components should sanitize to "", not "null". Then there's a couple things I feel like may be implicitly converted for checkboxes. But maybe keeping it bool only is the way to go. Then again that's a bit of the opposite approach to text components where we convert to string pretty much every time. Any thoughts? |
Thanks for sharing the table, I like that we tackle it! I agree that we should avoid mixtures of sanitized values as much as possible, and should be consistent across the components (cf. no surprises. That means I agree with removing "NaN" and sanitize to The same should go for text fields, that we sanitize to "" which equalizes the empty value for strings. Also for input data like |
Yeah, this was the Tasklist issue Yeah, I also agree with should avoid NaN
👍 I also agree |
Mhhh okay, I think it makes sense. The only issue with text fields is that we have it documented that types will be converted to string. So it would be a breaking change. |
In that case let's wait for @christian-konrad and make it a conscious decision. |
The obvious tasks from this issue have been covered, we're awaiting some feedback for what we want to do with the textfield and textarea components however, hence not yet closed. |
@Skaiir can we move this to "Done" or is it still waiting for something? |
Yeah sure, I like the state that it's at let's not overthink it. |
Describe the Bug
When initializing input of type numbers with the value
null
, these inputs show aNaN
error. Valuenull
should be accepted since they are valid output of a completed form.Steps to Reproduce
null
Expected Behavior
The input should show an empty field (since
null
is a valid output on form submissions)Additional information
The text was updated successfully, but these errors were encountered: