Calendar: Changing Calendar input (with mask) clears the rest of the form's state #4030
Labels
Type: Bug
Issue contains a defect related to a specific component.
Milestone
Describe the bug
Our users noticed when manually typing in a date in a
Calendar
input box, the rest of the state of the form gets cleared out.For example, the codesandbox link has 2 inputs. One is text, and one is a
Calendar
. If you have some text in theInputText
, then start typing in theCalendar
, yourInputText
gets cleared out.One thing to notice is all the inputs' states are wrapped in an object, rather than each being their own
useState
:var [form, setForm] = useState({ text: "", date: undefined });
Another important note: This problem only manifests when using the
mask
attribute on theCalendar
. If you removemask
this problem goes away and behavior is as expected.Reproducer
https://codesandbox.io/s/calendar-mask-problem-qxungp?file=/src/index.js
PrimeReact version
8.7.3
React version
18.x
Language
ALL
Build / Runtime
Create React App (CRA)
Browser(s)
No response
Steps to reproduce the behavior
Inside the codesandbox example:
Expected behavior
I expect the text in the InputText to not be deleted.
The text was updated successfully, but these errors were encountered: