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.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 3056908-6.patch | 2.98 KB | phenaproxima |
| #3 | Sreenshot-2.png | 31 KB | Ralf Eisler |
| #3 | Sreenshot-1.png | 28.41 KB | Ralf Eisler |
Comments
Comment #2
sonu.raj.chauhan commentedComment #3
Ralf Eisler commentedI have the same issue with Lightning 8.x-3.301 and Drupal core 8.7.2.
Comment #4
ashleyhazle commentedWe 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.
Comment #5
ashleyhazle commentedComment #6
phenaproximaWell, I think I know what's happening here. The upload button that Lightning uses is named
upload, notupload_button, and this is tripping up the implementation in file.js.Comment #7
ashleyhazle commented.
Comment #8
phenaproximaCrediting everyone involved in this issue.
Comment #10
phenaproximaCommitted and pushed to 8.x-3.x, and this will be in the next release. Thanks!
Comment #11
Ralf Eisler commented@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?