You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Link UI incorrectly anchored to "last" link within rich text contenteditable #58280
[Feature] Link EditingLink components (LinkControl, URLInput) and integrations (RichText link formatting)[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended
If you have multiple links within a block of rich text then the Link UI will be "anchor" to the final first link you clicked in the block.
So if you click the first link in the block and then click on other links, the popover will continue to anchor to the first link. Similarly if you clicked the last link first, it would continue to anchor to that link.
It should be anchored to the link that triggers it. I suspect this is due to the way in which we recently changed the usage of useAnchor to cache the first position.
The same problem lines also cause an issue where the popover is "fixed" on the page, so it doesn't stay attached to the link, but scrolls away from it.
But now if you create a new link and submit you'll see the popover is incorrectly positioned.
I think the incorrectly positioned new link issue has to do with the popover anchor changing from the paragraph to the link, but the popover anchor doesn't update to be anchored to the new element.
[Feature] Link EditingLink components (LinkControl, URLInput) and integrations (RichText link formatting)[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended
Activity
getdave commentedon Jan 25, 2024
cc @richtabor @jeryj @scruffian
getdave commentedon Jan 25, 2024
I confirmed that removing theses lines...
https://github.com/WordPress/gutenberg/blob/trunk/packages/format-library/src/link/inline.js#L208-L215
...will "fix" the problem. But now if you create a new link and submit you'll see the popover is incorrectly positioned.
jeryj commentedon Jan 25, 2024
The same problem lines also cause an issue where the popover is "fixed" on the page, so it doesn't stay attached to the link, but scrolls away from it.
I think the incorrectly positioned new link issue has to do with the popover anchor changing from the paragraph to the link, but the popover anchor doesn't update to be anchored to the new element.