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
When trying to reset an InputText by setting its value to an empty string, the "p-filled" class does not get cleared until the next render.
This is clearly noticeable when using an InputText with a FloatLabel. After setting the input's value to "", the float label stays up and doesn't come down until a new render happens. If more than 1 input were resetted at the same time withing the same function, all float labels would stay up. Also if I remove the class programmatically when resetting the value, the float label breaks because isFilled bool gets desynced with the class.
Apart from just feeling like unintended behavior, this bug leaves the developer with no proper way of resetting an InputText with a float label and the class can't be used as a safe way of adding further functionality or styles dependent on it.
If it is of any use, this bug is also present in v8, with react 17 and using Vite.
melloware
added
Type: Bug
Issue contains a defect related to a specific component.
and removed
Status: Needs Triage
Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
labels
May 8, 2023
melloware
changed the title
InputText: .p-filled class/isFilled bool not resetting after setValue("")
InputText/InputTextArea: .p-filled class/isFilled bool not resetting after setValue("")
May 10, 2023
Describe the bug
When trying to reset an InputText by setting its value to an empty string, the "p-filled" class does not get cleared until the next render.
This is clearly noticeable when using an InputText with a FloatLabel. After setting the input's value to "", the float label stays up and doesn't come down until a new render happens. If more than 1 input were resetted at the same time withing the same function, all float labels would stay up. Also if I remove the class programmatically when resetting the value, the float label breaks because isFilled bool gets desynced with the class.
Apart from just feeling like unintended behavior, this bug leaves the developer with no proper way of resetting an InputText with a float label and the class can't be used as a safe way of adding further functionality or styles dependent on it.
If it is of any use, this bug is also present in v8, with react 17 and using Vite.
Reproducer
https://codesandbox.io/s/interesting-banach-8i36zg?file=/src/demo/FloatLabelDemo.js
PrimeReact version
9.3.1
React version
18.x
Language
ALL
Build / Runtime
Create React App (CRA)
Browser(s)
No response
Steps to reproduce the behavior
Add a Float Label to the InputText if visual feedback is needed for testing.
Expected behavior
I expect the "p-filled" class of the InputText to be cleared in the same render I set the value of the input to an empty string (reset the InputText).
The text was updated successfully, but these errors were encountered: