You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have an input element of type number that has an invalid input. Trying to set that input back to nothing via the Elm equivalent of numberInput.value = "" does not work.
Here is an Ellie to demonstrate what I'm talking about.
If you try to type in a number, nothing will show up. This is what you'd expect, as value is constantly being set to "". However, if you type something invalid, such as some combination of e, E, ., and -, you'll notice that you're allowed to type this.
Turns out that if a number input is invalid, its value property will return "". That being said, if you set the value of it to "" explicitly, it will change the input to be nothing.
My guess here is that Elm's virtual DOM is checking the value of the input with .value, seeing that it equals "", and then concluding that nothing needs to be changed.
It doesn't seem like there's any way to get the true value out of a number input, so it would seem like the only fix for this (assuming my diff hypothesis is correct) is to just always execute numberInput = "" regardless of the diff.
The text was updated successfully, but these errors were encountered:
If you have an input element of type number that has an invalid input. Trying to set that input back to nothing via the Elm equivalent of
numberInput.value = ""
does not work.Here is an Ellie to demonstrate what I'm talking about.
If you try to type in a number, nothing will show up. This is what you'd expect, as
value
is constantly being set to""
. However, if you type something invalid, such as some combination ofe
,E
,.
, and-
, you'll notice that you're allowed to type this.Turns out that if a number input is invalid, its value property will return
""
. That being said, if you set the value of it to""
explicitly, it will change the input to be nothing.My guess here is that Elm's virtual DOM is checking the value of the input with
.value
, seeing that it equals""
, and then concluding that nothing needs to be changed.It doesn't seem like there's any way to get the true value out of a number input, so it would seem like the only fix for this (assuming my diff hypothesis is correct) is to just always execute
numberInput = ""
regardless of the diff.The text was updated successfully, but these errors were encountered: