Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: clear input value on clearFiles from imperative handle #3090

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Steven7926
Copy link

@Steven7926 Steven7926 commented Jan 5, 2025

Summary

A simple change that clears the input elements value in a file input component when the files state is cleared through the imperative handle.

First PR so any feedback would be greatly appreciated. Thanks!

Closes #3089

How To Test

  1. Use the FileInput component with ref and custom handlers that has a "clear files" button. Story Book example: https://trussworks.github.io/react-uswds/?path=/story/components-file-input--with-ref-and-custom-handlers
  2. Add a file to the FileInput component.
  3. Clear the file using the clear files button.
  4. Ensure the file clears.
  5. Add a new file to the FileInput
  6. Ensure the event is fired and the file i added properly to the component.

@Steven7926 Steven7926 requested review from a team as code owners January 5, 2025 02:43
@Steven7926 Steven7926 changed the title Clear input value on clearFiles from imperative handle fix:clear input value on clearFiles from imperative handle Jan 5, 2025
@Steven7926 Steven7926 changed the title fix:clear input value on clearFiles from imperative handle fix: clear input value on clearFiles from imperative handle Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[fix]File Input with Ref does not allow readding a file after clearing the file.
1 participant