Problem/motivation
When editing an existing link using linkit field widget, if the user do not select any suggestion neither update the value manually, focusing out the input, autocomplete.js assumes the user has manually changed the value.
https://git.drupalcode.org/project/linkit/-/blob/7.x/js/linkit.autocompl...
The logic depends by the comparison between uri field and href hidden that are populated with two different values by the widget. So they are almost alway different when focusing out without changes.
Steps to reproduce
- Using linkit widget search for a content and select one suggestion
- Save
- Edit the node, focus the link input and focus out without any change
- The hidden values for the metadata are now empty
Proposed resolution
Perform $uri.focusout logic only when the uri value is actually changed.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | Screen Recording 2026-05-15 at 15.07.43.mov | 28.61 MB | marco.pagliarulo |
| #5 | linkit--linkit-autocomplete-lost-metadata-3589260-3.patch | 2.79 KB | marco.pagliarulo |
Issue fork linkit-3589260
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
Comment #2
marco.pagliarulo commentedComment #3
marco.pagliarulo commentedComment #4
marco.pagliarulo commentedComment #5
marco.pagliarulo commentedComment #7
marco.pagliarulo commentedComment #8
mark_fullmerThanks for reporting this. I'm having difficulty reproducing the problem described. Could you provide more specific steps, or a video demonstrating the problem?
Comment #9
marco.pagliarulo commentedIn the uploaded video you can see, editing a content that has a link field (using linkit field widget), the metadata values are correct, but as soon as the user focus the field, without making any change focus out, the values are gone. Now that value is not anymore a linkit value but just a normal URL.
Comment #10
mark_fullmerComment #12
mark_fullmerThanks for the video. I am now able to reproduce the problem, following that example. I agree with the reasoning for the general approach to store the URI for a scenario where focusout happens without a selection. The implementation makes sense. Merging. I'll go ahead and create a new release that includes this, as well as a couple other recent fixes.
Comment #14
marco.pagliarulo commentedThanks a lot