Yuvaleros / material-ui-dropzone

A Material-UI file upload dropzone
MIT License
483 stars 248 forks source link

Change description of onDrop #355

Closed K02D closed 1 year ago

K02D commented 1 year ago

Description

Update the description of the onDrop prop in DropzoneAreaBase.

Currently, the docs say that onDrop is fired whenever files are dropped onto the dropzone but it's slightly unclear whether onDrop is fired only when the files are accepted, or when the files are accepted or rejected.

image

If we look at the relevant code here we see that onDrop is fired only when files are accepted.

I wanted to make this change because if we look at the props for Dropzone in the react-dropzone library, onDrop is fired when the files are either rejected or accepted:

image

Thus, I thought a user might incorrectly assume DropzoneAreaBase's onDrop to behave similarly to Dropzone's onDrop and expect it to return all dropped files, whether rejected or accepted.

Ideally, I would've liked to rename the onDrop prop to onDropAccepted but that would be a breaking change so I thought updating the docs would suffice. Thank you!

Type of change

How Has This Been Tested

Test Configuration:

Checklist

K02D commented 1 year ago

@Yuvaleros Hi sorry to ping you but if you have a look at this PR, that'd be great!