Carbon: FileUploader should provide an onDelete hook for deleting files

Created on 13 Apr 2020  路  4Comments  路  Source: carbon-design-system/carbon

Currently the FileUploader does not provide an onDelete method for performing actions when an uploaded file is deleted. Users must hook into onClick and catch the cases where the target is the deleted file. Not only is this not very efficient since onClick is triggered for other events, it's also unintuitive with no documentation that this is how you should handle this functionality. Providing an onDelete hook would take care of these issues.

file-uploader dev 馃 help wanted 馃憪 enhancement 馃挕

All 4 comments

@emyarod The on Click function on FileUploader component is wrongly implemented. It is passed on as a prop to the whole component. That is why it is been called on click of the whole file uploader. This is one issue. It can be solved using two ways.

  1. If we don't want onClick on the uploader then rename it to onDelete and apply that to only Filename's onClick and onKeyDown.

  2. If we want onClick on the uploader then separate onDelete have to be created and applied to Filename's onClick and onKeyDown. And what will be the purpose of this onClick?

@code-blooded-developer yep I noticed that and will be addressing it

@emyarod you started working on this? I was kind of working on this

@code-blooded-developer yes I have PR on the way once the onClick pattern has been cleared up

in the future if you plan to begin work you can leave a message in the ticket to notify us. typically I will mark open work by assigning the ticket to myself

Was this page helpful?
0 / 5 - 0 ratings