Problem/Motivation

At some point after upgrading to Drupal 10 the selection stopped working. The File upload widget works okay but the View display for selection just refreshes and does not submit any selections.

Steps to reproduce

Install module on Drupal 10 and install the example modules. Set a image field to use the file selection modal. Observe that node edit/add forms are not able to select an item.

I'm not seeing any JS or PHP errors thrown so it's really confusing. All I can tell is that the View is submitting and refreshing via AJAX. The exposed filters don't seem to be working either to look up the name.

Comments

nsciacca created an issue. See original summary.

joseph.olstad’s picture

Title: Unable to select any items, no errors thrown, Drupal 10 » Unable to select any items, js error, Drupal 10
Parent issue: » #2998066: Field widget for the Media library is not compatible with inline form errors

This is a duplicate of:

#2998066: Field widget for the Media library is not compatible with inline form errors

A fix is available and it does work, I have tested the fix.

If you inspect your console, you'll see a related javascript exception.

joseph.olstad’s picture

Title: Unable to select any items, js error, Drupal 10 » Unable to select any items, Drupal 10
Status: Active » Needs review

seems to me related as I mentioned, please review the linked patch

https://www.drupal.org/files/issues/2019-08-15/2998066-disable-inline-fo...

joseph.olstad’s picture

Here's the two patches I'm using with D10, php 8.1

2914385 - Fix PHP error
Source: https://www.drupal.org/files/issues/2022-04-21/entity_browser-key-2914385-12.patch

2998066 - Fix for media library selection on structured page node edit.
Source: https://www.drupal.org/files/issues/2019-08-15/2998066-disable-inline-form-errors.patch

If you want to use PHP 8.2, you'll need more patches for entity_browser

nsciacca’s picture

@joseph.olstad Thanks for the reply but what's interesting is that I don't have Inline Form Errors enabled. There are no javascript errors thrown and nothing on the PHP side in the watchdog logs. Here's a video of me trying to select something:

https://www.dropbox.com/scl/fi/zr0lhshhkzl4cunjuf2lm/Entity-Browser-AJAX...

I guess there could be something else in our custom code that could be conflicting so I will try to spin up a vanilla Drupal with similar config to see if I can replicate it there.

nsciacca’s picture

Okay I found that it is a conflict with a patch I have for Drupal core:

"2858890 - Drupal.views.ajaxView is not initializing pagers in nested views": "private/patches/2858890-core-views-ajax-nested-pagers.patch",

We can close and I'll investigate whether those are needed anymore

robbdavis’s picture

I am also seeing this issue. The above patches don't help. No errors in the console.

nsciacca’s picture

@robbdavis - If you've previously patched core for the same issue I have noted above, try the patch from the MR over on https://www.drupal.org/project/drupal/issues/2858890#comment-15337125

I ended up making some adjustments there and it helped.

https://git.drupalcode.org/project/drupal/-/merge_requests/4242/diffs.patch

shani maurya’s picture

None of the above solutions has worked on my side. I have Drupal 10.1.6 and PHP 8.1. Nothing in the console and php log.

shani maurya’s picture

Priority: Normal » Critical
Status: Needs review » Active
tcmktg’s picture

No patches that actually work yet. Using 10.1.7 and Php 8.1.

joseph.olstad’s picture

shelane’s picture

Version: 8.x-2.9 » 8.x-2.10

I still have this issue with the 2.10 version that was just released that includes the inline form errors fix. So, that is not related to this problem. I click on images to be able to select, but nothing happens. No errors are reported in the inspector console or in the watchdog log. This is on both a php 8.1 and php 8.2 with Drupal 10.1.7.

simon2d’s picture

Hi all,

Just confirming I'm experiencing the same issue as everyone else is mentioning

We have a custom block with field that is an entity reference media type. When adding a new image, we can only select the image via the checkbox and click insert. But clicking insert swirls for a few seconds and then doesn't attach the image on the page.

This has occurred for us when switching from 10.0.11 to 10.1.0 (or higher, have tested 10.1.6 as well)

Using the dev version, or the patches above has not fixed the issue

Regards
S

shelane’s picture

StatusFileSize
new24.57 KB
new9.03 MB

I still don't see errors, but I did a screen shot of my settings and a screen recording of the action. Also, in this recording, I demonstrate a work around. It's hard to see in the first part that I am trying to click on the images and nothing happens. I click over to the Upload tab and then click back to the Library tab and it starts working.

simon2d’s picture

Hi all, is there any update on this issue? We are still experiencing it on 10.1.x

diego sabolo’s picture

StatusFileSize
new358.83 KB

I hope this can help, In my case, I've experienced that issue after upgrading to 10.x and I've fixed it with a configuration change.

Go to the entity browser configuration page (admin/config/content/entity_browser), select the entity browser you are using in your field, got to the Widgets Settings tabs. ensure you use the default media browser widget provided by the module and not a plugging from a third-party contributor (In my case lightning media)

See attached screenshot:
Only local images are allowed.

lisagodare’s picture

Thanks to the clue about Lightning Media, I was able to hunt down my issue and fix it.

Specifically, using Media: Image Browser, if the Image field in question allowed more than one reference, I would not be able to select images in the entity browser. @shelane's workaround did work though.

Patch over there fixes it for me:
https://www.drupal.org/project/lightning_media/issues/3392244#comment-15...

anybody’s picture

Status: Active » Closed (outdated)