Carbon: file-uploader does not emit eventAfterDeleteFilenameFileuploader and eventBeforeDeleteFilenameFileuploader

Created on 2 Jul 2019  路  1Comment  路  Source: carbon-design-system/carbon

What package(s) are you using?

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

Detailed description

Describe in detail the issue you're having.

When removing a file from the file-uploader component by clicking its "x" button, the events eventBeforeDeleteFilenameFileuploader and eventAfterDeleteFilenameFileuploader are not emitted.

Is this issue related to a specific component?

file-uploader

What did you expect to happen? What happened instead? What would you like to
see changed?

I expected the events to be fired so I can respond to file removal by the user.

What browser are you working in?

Chrome

What version of the Carbon Design System are you using?

10.3.2

What offering/product do you work on? Any pressing ship or release dates we
should be aware of?

ICP4I Operations Dashboard

Steps to reproduce the issue

  1. Create a file uploader component
  2. Add event listeners of the mentioned events
  3. Add a file
  4. Click on "x" on the file that appears below the "Add File" button
  5. Event listeners should have been fired, but they're not

Additional information

The problem is within the JS code.
Instead of calling changeState() the code is invoking _changeState(), which bypasses all standard event firing code of evented-state.

/**
   * Handles delete button.
   * @param {Event} evt The event triggering this action.
   * @private
   */
  _handleDeleteButton = evt => {
    const target = eventMatches(evt, `[data-for=${this.inputId}]`);
    if (target) {
///////////////// HERE vvv
      this._changeState('delete-filename-fileuploader', {
///////////////// HERE ^^^
        initialEvt: evt,
        filenameElement: target.parentNode,
      });
    }
  };
bug 馃悰

Most helpful comment

Hi 馃憢 thank you for reporting! I believe @emyarod is addressing this problem as part of #3175 - Stay tuned!

>All comments

Hi 馃憢 thank you for reporting! I believe @emyarod is addressing this problem as part of #3175 - Stay tuned!

Was this page helpful?
0 / 5 - 0 ratings