Closed (fixed)
Project:
Autocomplete Deluxe
Version:
2.1.x-dev
Component:
Code (miscellaneous)
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Jun 2022 at 21:47 UTC
Updated:
14 Sep 2026 at 14:10 UTC
Jump to comment: Most recent, Most recent file

Comments
Comment #2
sleepingmonkComment #3
rajab natshahThank you, Calvin for reporting, and for pinning it to that line.
Reproduced the failing shape on a fresh Drupal 11.4 site with only this module and a field of its own: reaching into the autocomplete data of an input that jQuery UI never initialised throws TypeError: Cannot set properties of undefined (setting '_resizeMenu'), which is the error you saw in the dialog.
The patch guards that one line. On the same site the ordinary field is unchanged: the data is there, the resize override is still applied, the suggestion list opens, a tag is added and the node saves.
Attaching it as a patch rather than a merge request, since the issue fork could not be created just now. Happy to move it to a merge request afterwards.
To review, test, then merge.
Comment #5
rajab natshahThank you Calvin for reporting this, and for pinning it to the line.
I have opened a merge request against 2.1.x. The widget was reaching into the autocomplete data of the input and setting
_resizeMenuon it without checking that jQuery UI had ever initialized an autocomplete there. Where it had not, that line threw. It is now skipped when there is nothing to override, and the suggestion list simply resizes the way jQuery UI wants to, which is a much better outcome than the widget falling over.I should be straight about one thing: the Linkit media library dialog no longer fails on 2.1.x with Drupal 11.4. I set it up on a fresh 11.4.5 site with Linkit, Media and Media Library, put the widget on the media library form display, and everything initialized cleanly with no console errors. Current Drupal gives elements rendered over AJAX a random suffix on their ID, which quietly removed the duplicate ID collision that caused your original report.
The line is still worth guarding, though. Reaching into the autocomplete data of an input that jQuery UI never touched throws exactly the error you saw, and I confirmed that in the console on that same site. So this goes in as hardening rather than as a fix for your scenario, and the merge request says so plainly.
With the guard in place I added a tag inside the dialog and saved the media, and the term was stored correctly with no duplicate created.
There is no automated test, on purpose. The situation the guard protects against cannot be reached through the interface on any supported Drupal, so a browser test would pass whether or not the fix were there and would prove nothing. Testing it properly would need a JavaScript unit test harness, which this project does not have yet and which deserves an issue of its own.
One thing I noticed while in there, worth its own issue:
MultipleWidget()is handed the input element as its first argument and never uses it, resolving the element with a document-wide ID lookup instead. That lookup is the real reason the widget can ever end up attached to the wrong node.Prepared with AI assistance (Claude), reviewed and driven by the maintainer.
Comment #7
rajab natshah