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

  1. Using linkit widget search for a content and select one suggestion
  2. Save
  3. Edit the node, focus the link input and focus out without any change
  4. The hidden values for the metadata are now empty

Proposed resolution

Perform $uri.focusout logic only when the uri value is actually changed.

Issue fork linkit-3589260

Command icon 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

marco.pagliarulo created an issue. See original summary.

marco.pagliarulo’s picture

Title: Linkit autocomplete lost » Linkit autocomplete lost metadata
marco.pagliarulo’s picture

Issue summary: View changes
marco.pagliarulo’s picture

Version: 7.1.x-dev » 7.x-dev
marco.pagliarulo’s picture

Status: Active » Needs review
StatusFileSize
new2.79 KB

marco.pagliarulo’s picture

Assigned: marco.pagliarulo » Unassigned
mark_fullmer’s picture

Status: Needs review » Active

Thanks for reporting this. I'm having difficulty reproducing the problem described. Could you provide more specific steps, or a video demonstrating the problem?

marco.pagliarulo’s picture

StatusFileSize
new28.61 MB

In 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.

mark_fullmer’s picture

Title: Linkit autocomplete lost metadata » Linkit autocomplete loses metadata if autocomplete triggered but no selection made

mark_fullmer’s picture

Status: Active » Fixed

Thanks 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.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

marco.pagliarulo’s picture

Thanks a lot

Status: Fixed » Closed (fixed)

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