One more thing I hate: <input type=number /> coerce to a number when bind:value #15058
NormandoHall
started this conversation in
General
Replies: 1 comment 2 replies
-
You don't have to use the binding if you don't want this behavior. <script>
let value = $state('1.0');
</script>
<input type=number {value} oninput={e => value = e.currentTarget.value} /> |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
As say in docs https://svelte.dev/docs/svelte/bind#input-bind:value I think this is really bad. This breaks a lot of code and validations suites.
Why????
I'm a developer, not a silly kid. Numeric input are for UI (browser/mobile) purposes, but it should always be a string. Leave things the way they always were, even before Svelte existed!
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number
Please, stop!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! PLEASE STOP!!!!!!!!!!
Beta Was this translation helpful? Give feedback.
All reactions