After update to lightning 4.0.0 and Drupal core 8.7, auto upload on file upload entity browser is no longer working.

A possible reason for this could be file.js code changes for file module introduced in Drupal 8.7

Quick comparison

Drupal 8.6 file,js snippet for auto upload trigger function

triggerUploadButton: function triggerUploadButton(event) {
$(event.target).closest('.js-form-managed-file').find('.js-form-submit').trigger('mousedown');
}

Drupal 8.7 file.js snippet for auto upload trigger function

triggerUploadButton(event) {
$(event.target).closest('.js-form-managed-file').find('.js-form-submit[data-drupal-selector$="upload-button"]').trigger('mousedown');
}

We can see there is a change in the selector for the hidden upload button attributes. Now in addition to the class .js-form-submit, the js also looks for data-drupal-selector attribute ending with upload-button text.

Comments

sonu.raj.chauhan created an issue. See original summary.

sonu.raj.chauhan’s picture

Issue summary: View changes
Ralf Eisler’s picture

StatusFileSize
new28.41 KB
new31 KB

I have the same issue with Lightning 8.x-3.301 and Drupal core 8.7.2.

ashleyhazle’s picture

We are also experiencing this issue with lightning_media 8.x-3.8. All other upload options work, only the file upload widget is affected.

As this prevents sites using lightning_media and the file_upload widget from being able to upload media, I'm increasing the priority of this issue.

ashleyhazle’s picture

Priority: Normal » Major
phenaproxima’s picture

Version: 8.x-3.8 » 8.x-3.x-dev
Status: Active » Needs review
StatusFileSize
new2.98 KB

Well, I think I know what's happening here. The upload button that Lightning uses is named upload, not upload_button, and this is tripping up the implementation in file.js.

ashleyhazle’s picture

Status: Needs review » Reviewed & tested by the community

.

phenaproxima’s picture

Crediting everyone involved in this issue.

  • phenaproxima committed 315c48b on 8.x-3.x
    Issue #3056908 by phenaproxima, Thomas Factory, ashleyhazle, sonu.raj....
phenaproxima’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x-3.x, and this will be in the next release. Thanks!

Ralf Eisler’s picture

@phenaproxima

Thank you for the patch.

I was not aware that this is on 8.x-3.x-dev and patched 8.x-3.x which worked for:

diff --git a/src/Element/AjaxUpload.php b/src/Element/AjaxUpload.php
diff --git a/src/Element/InteractiveUpload.php b/src/Element/InteractiveUpload.php

but not for

diff --git a/src/Plugin/EntityBrowser/Widget/FileUpload.php b/src/Plugin/EntityBrowser/Widget/FileUpload.php

As a result, an image cannot be chosen a second time from the media library (it does not appear in the entity browser widget although it is in the media library).

Can you provide a patch for 8.x-3.x?

Status: Fixed » Closed (fixed)

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