Carbon: File uploader button labelText changes to name of file when a new file is added

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

What package(s) are you using?

  • [x] carbon-components
  • [x] carbon-components-react

Detailed description

Describe in detail the issue you're having.
When a file is added using the FileUploaderButton it changes it's labelText to be the same as the file's name.

Is this issue related to a specific component?
FileUploaderButton

What did you expect to happen? What happened instead? What would you like to
see changed?
I would like the labelText of the button to not change when a file is uploaded

What browser are you working in?
Chrome

What version of the Carbon Design System are you using?
10.10.3

Steps to reproduce the issue

  1. Use a file uploader button
  2. Upload a file
  3. See the labelText of the button change to the name of the file

Please create a reduced test case in CodeSandbox

file-uploader dev 馃 bug 馃悰

All 4 comments

FileUploaderButton will always change the text to be the file text, because it is not displayed anywhere else. Can you try using the regular `

<FileUploader
  multiple={false}
  labelTitle="Im gonna change"
  buttonLabel= 'Add files'
  onChange={event => {
    onFileAdded(event.target.files);
  }}
/>

Screen Shot 2020-04-20 at 11 12 52 AM

I initially did it manually using FileUploaderButton because I needed an event to bind to onDelete for the FileUploaderItem. I most likely missed something but I can't seem to find that event when using the regular FileUploader

currently only the drag and drop file uploader has hooks for the delete event, related issue for the standard file uploader here https://github.com/carbon-design-system/carbon/issues/5851

Cool, thanks for the reply! 馃槃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

skaparelos1 picture skaparelos1  路  3Comments

kalyanixraut picture kalyanixraut  路  3Comments

AnthumChris picture AnthumChris  路  3Comments

PatrickDuncan picture PatrickDuncan  路  3Comments

windgaucho picture windgaucho  路  3Comments