hperrin / svelte-material-ui

Svelte Material UI Components
https://sveltematerialui.com/
Apache License 2.0
3.27k stars 287 forks source link

[Text Field] The specified value "NaN" cannot be parsed, or is out of range. #633

Open vhscom opened 8 months ago

vhscom commented 8 months ago

Describe the bug Given a very basic SMUI number input defined like:

<Textfield bind:value label="Quantity" type="number" input$name="quantity"/>

<script>
  import Textfield from '@smui/textfield';

  let value = '';
</script>

Pressing delete or backspace using the keyboard causes SMUI to throw:

The specified value "NaN" cannot be parsed, or is out of range.

SMUI throws at WARN level and, in this case, twice each time the value is cleared by the user.

To Reproduce Steps to reproduce the behavior:

  1. Go to the Different input types demo on the SMUI Text Field demo
  2. Open browser dev console and enable warning log level
  3. Locate the Number input example in the demo and clear the value using the keyboard
  4. Observe console message which is noisy and obtrusive to development workflow

Expected behavior SMUI does not attempt to parse NaN unless the field value is explicitly set to NaN in userland.

Screenshots

Screenshot 2023-10-19 at 2 59 26 PM

Desktop (please complete the following information):

Additional context I believe this is related to #40 which was closed.