### Problem/Motivation

The s3fs CORS file widget hides its file input as soon as a file is picked. `Drupal.s3fsCors.createProgressBar()` sets `fileInput.style.display = 'none'` before the upload promise chain runs. If the upload then fails for any reason -- the client-side `max_size` validator rejecting an oversized file, an extension mismatch, an S3 PUT error, or the Drupal save step failing -- the `.catch(showError)` handler runs and the `.finally` only removes the progress bar and re-enables the submit buttons. Nothing restores the input's `display`, so it stays `display: none`.

The user is left looking at an error message with no visible file input and no Remove button. There is no way to pick a replacement file; the only recovery is reloading the page and losing any other unsaved form input.

### Steps to reproduce

1. Add an `s3fs_cors_file_widget` field (e.g. on a media type).
2. On the add/edit form, pick a file larger than the field's max upload size.
3. The client-side validator rejects it and shows "Max size allowed is: X".
4. Observe the file input is now `display: none` (`offsetParent === null`). The upload control is gone and the user cannot select another file without reloading.

### Proposed resolution

In `Drupal.s3fsCors.showError()`, restore the input that `createProgressBar()` hid by setting `fileInput.style.display = ''` alongside the existing `fileInput.value = ''`. `showError` is the single `.catch` for the whole promise chain, so this covers every failure path. On success the widget AJAX-re-renders, so the restore is a no-op there.

### Remaining tasks

Review + merge.

### User interface changes

After a failed upload the file input stays visible so the user can immediately choose a different file.

### API changes

None.

### Data model changes

None.

Issue fork s3fs_cors-3594274

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ethant created an issue. See original summary.

  • heddn committed 51be954e on 8.x-1.x authored by ethant
    fix: #3594274 File input stays hidden after a failed upload, leaving no...
heddn’s picture

Status: Active » Fixed

Thanks for the fixes

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.