nextui icon indicating copy to clipboard operation
nextui copied to clipboard

[BUG] - Input required does not clear when using controlled component

Open dennyferra opened this issue 1 year ago • 1 comments

NextUI Version

2.3.6

Describe the bug

I'm using a controlled Input component with isRequired and I have functionality to reset the form back to some previous state. If a user clears out the input field, triggers the validation by clicking away from the input (validation will show that the field is required), then clicks a button to reset the input value, the required validation continues to display even though a valid value is set in the input. Additionally, focusing the input (and un-focusing) does not cause the validation to clear either.

Example sandbox here: https://codesandbox.io/p/devbox/exciting-margulis-6y6h37

Your Example Website or App

https://codesandbox.io/p/devbox/exciting-margulis-6y6h37

Steps to Reproduce the Bug or Issue

  1. Clear the input
  2. Click off input to trigger validation
  3. Click Update button
  4. Notice email field is populated but validation still shows
  5. Only changing input then change focus causes validation to clear

Expected behavior

After resetting the value I would expect the validation error to clear.

Screenshots or Videos

No response

Operating System Version

Windows

Browser

Chrome

dennyferra avatar May 08 '24 18:05 dennyferra

@wingkwong can i work on this one. You have assigned it to yourself that's why i am asking?

abhisektomar1 avatar Jul 01 '24 10:07 abhisektomar1

@abhisektomar1 Sure. I'm a fully occupied these days. Feel free to ping me if you have any questions. Thanks.

wingkwong avatar Jul 01 '24 10:07 wingkwong

I don't reproduce this issue. code and dev mode are different.

the code do not controll the Input's color and the error message

jijiseong avatar Jul 18 '24 06:07 jijiseong

@jijiseong Thanks for checking. in fact we've changed the validation behaviour in v2.4.0 so this issue should be no longer reproducible in latest version.

wingkwong avatar Jul 18 '24 07:07 wingkwong