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: adjust CvFileUploader drop handler to not ignore 'multiple' attribute #1693

Conversation

felipebritor
Copy link
Contributor

Contributes to #1663

What did you do?

Update 'drop' event handler, at CvFileUploader, to handle files considering 'multiple' attribute

Why did you do it?

Fix the drop behavior when multiple is falsy

How have you tested it?

Yes. Automated tests also added.

Were docs updated if needed?

  • N/A
  • No
  • Yes

@felipebritor felipebritor changed the title Fix: adjust CvFileUploader drop handler to not ignore 'multiple' attribute fix: adjust CvFileUploader drop handler to not ignore 'multiple' attribute Dec 23, 2024
@davidnixon
Copy link
Collaborator

@felipebritor a tweak is still needed.

  1. This does prevent me from selecting multiple files and dropping them on the target. When I do that I only get 1 file as expected. ✅
  2. I can however drag and drop a file and then drag and drop another file so that now there are two! ❌
  3. The multiple attribute should default to true ❌
  4. The React story is unclear on how the button mode (non drag & drop mode) should work. I wonder if you or @themoenen has an opinion on that?

Referencing the same component in res=act:
https://react.carbondesignsystem.com/?path=/story/components-fileuploader--drag-and-drop-upload-container-example-application&args=multiple:!false

Check 'multiple' attr before passing files to 'addFiles'. if multiple is
falsy, it will only pass the first dropped file.
multiple should be true by default, so we have to turn it into a prop
@felipebritor felipebritor force-pushed the fix-fileuploader-multiple-on-drop branch from 3ad044f to 3d80752 Compare January 10, 2025 00:50
@felipebritor
Copy link
Contributor Author

@felipebritor a tweak is still needed.

  1. This does prevent me from selecting multiple files and dropping them on the target. When I do that I only get 1 file as expected. ✅
  2. I can however drag and drop a file and then drag and drop another file so that now there are two! ❌
  3. The multiple attribute should default to true ❌
  4. The React story is unclear on how the button mode (non drag & drop mode) should work. I wonder if you or @themoenen has an opinion on that?

Referencing the same component in res=act: https://react.carbondesignsystem.com/?path=/story/components-fileuploader--drag-and-drop-upload-container-example-application&args=multiple:!false

Regarding your points:
2. Sorry about it, David. Fixed
3. Added to PR. Had to turn multiple into a props for it
4. I think it does here. Or did you mean something else?

Copy link
Collaborator

@davidnixon davidnixon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!! LGTM

@davidnixon davidnixon merged commit 077b495 into carbon-design-system:main Jan 13, 2025
6 checks passed
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.

2 participants