Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared state between two instances of Link Control in same block #35618

Closed
tellthemachines opened this issue Oct 14, 2021 · 2 comments
Closed
Labels
[Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) [Type] Bug An existing feature does not function as intended

Comments

@tellthemachines
Copy link
Contributor

Description

When there are two links in one block, opening the link control and clicking "edit" on one, without saving any changes, will cause the link control of the other one to open in edit mode too. Furthermore, making an edit in one of the link controls and not saving, will cause the edited value from the first link control to show in the second link control when opened.

Step-by-step reproduction instructions

  1. Add two separate links to a paragraph.
  2. Open the link control and click "edit" on the first one.
  3. Change the URL, but don't save.
  4. Click the second link to open its link control.
  5. Verify that not only does it open in edit mode, its value is the same as the edited value from the first link.

Variation: on step 3, don't make any change. On step 5 verify the second link control also shows the same value as the first.

Expected behaviour would be that a link control never open in edit mode, and that its value, or edits to its value, not be shared with other link controls in the vicinity.

Screenshots, screen recording, code snippet

repeat-edits

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@tellthemachines tellthemachines added [Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) [Status] Not Applicable Issue outside Gutenberg, is not a bug, or is a support request. [Type] Bug An existing feature does not function as intended and removed [Status] Not Applicable Issue outside Gutenberg, is not a bug, or is a support request. labels Oct 14, 2021
@getdave
Copy link
Contributor

getdave commented Oct 14, 2021

In #32320 I suggested forcing a remount of <LinkControl> when the value?.url changes. Feels quite drastic though.

Other options also listed there. Would appreciate more 👀 to help come to a good solution.

@getdave
Copy link
Contributor

getdave commented Nov 14, 2021

This has now been fixed in #34742

@getdave getdave closed this as completed Nov 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

2 participants