jaredpalmer / formik

Build forms in React, without the tears 😭
https://formik.org
Apache License 2.0
33.77k stars 2.78k forks source link

Filed Type number work unnormal in safari #3750

Open ChaserRun opened 1 year ago

ChaserRun commented 1 year ago

Bug report

When i use Field Components and set type number entry point later Field content be clear up. In Chrome my code work normal

Current Behavior

Expected behavior

Reproducible example

Suggested solution(s)

Additional context

Your environment

Software Version(s)
Formik 2.2.9
React 17.0.1
TypeScript
Browser
npm/Yarn
Operating System
Safari 16.3
cfordretextion commented 1 year ago

I am running into this issue as well On Safari 16.4 and Safari 16.2. Here is the code block:

<Field
        component={FieldWithFormik}
        label={`New ${showQuantityField ? 'Quantity' : 'Price'}`}
        type="number"
        sx={{ width: '100px' }}
        name={`modules[${idx}].actions[${idx2}].${showQuantityField ? 'quantity' : 'price'}`}
      ></Field>

You cannot make this number a decimal. Whenever you try to put a decimal point in, the field value changes to "NaN" and the value is wiped out. This worked as expected for me in Firefox, Chrome and Safari 14. I just ran into it with these two Safari versions mentioned above.

Please let me know if you need more details.

quantizor commented 1 year ago

A sandbox to use for reproducing the issue would be appreciated, thanks.