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

Pasting same-page link adds admin page URL #28115

Open
sabernhardt opened this issue Jan 11, 2021 · 14 comments
Open

Pasting same-page link adds admin page URL #28115

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

Comments

@sabernhardt
Copy link
Contributor

Original report by hage
Trac #52105

Describe the bug
When copying and pasting anchor links, the links have an incorrect destination by adding the page's admin URL.

Steps to reproduce the behavior:

  1. Create text within a rich text block (paragraph, heading, or list).
  2. Create a link on all or part of that text, so that it leads to a section on the same page (#destination).
  3. Either cut or copy the link.
  4. Paste the link in another block or another part of the same block.
  5. Click on the link to open the link editor dialog and see the full URL of the admin page for the new link's target location plus #destination.

Expected behavior
The link should remain a same-page link.

Screenshots

Before moving:
link is only the target of #entwicklung

After moving:
link includes admin URL

Another screenshot after pasting (WP 5.6, without Gutenberg or Yoast plugins):
WordPress 5.6, after pasting

WordPress versions

  • 5.6 without Gutenberg plugin
  • also 5.0 without Gutenberg
  • also 5.7 trunk (49950) with Gutenberg 9.7

Desktop (please complete the following information):

  • OS: Windows 10, 1909
  • Browsers: Chrome 87.0.4280.88 and Firefox 84.0.2
@aristath
Copy link
Member

@sabernhardt I couldn't replicate this issue... Does this also happen when manually entering the URL instead of copy-pasting it? Where exactly was the anchor URL copied from? I tried copying it from the "HTML Anchor" field of another block but there was no issue when I tried that either. 🤔

@aristath aristath added [Type] Bug An existing feature does not function as intended Needs Testing Needs further testing to be confirmed. labels Jan 12, 2021
@sabernhardt
Copy link
Contributor Author

Sorry for the confusion. I did not mean the HTML Anchor field.

Hopefully this clarifies it a bit:

  1. When creating a text link, manually type the destination to direct to an anchor elsewhere in the same post.
  2. Then cut or copy that text link, and paste it in another place within the post content.
  3. The link URL no longer matches what you typed.

@skorasaurus skorasaurus added Needs Testing Needs further testing to be confirmed. and removed Needs Testing Needs further testing to be confirmed. labels Feb 17, 2021
@paaljoachim
Copy link
Contributor

Testing using WordPress 5.7
Gutenberg plugin 10.2.1.
Twenty Twenty One.

Added an internal link. Copied the text that had the link. Pasted the text and link into another text block.
I am seeing an identical link.

@gwwar
Copy link
Contributor

gwwar commented Mar 25, 2021

@sabernhardt Do you mean this flow?

pastelink.mp4

For other copy/duplication paths it looks okay:

copylink.mp4

@paaljoachim
Copy link
Contributor

This issue might be associated:
Insert Link: clicking on same-page links reloads the editor
#10117

@sabernhardt
Copy link
Contributor Author

It seems this has been fixed elsewhere.

I've used the Ctrl + C/V keyboard shortcuts for copying and pasting the linked text, so it's basically the same as the browser context menu (flow 1).

I tried again today with 5.7 in Firefox 86.0.1, both with and without Gutenberg 10.2.1 activated.

  • With the plugin, it pastes the link without the full URL.
  • Without the plugin, it still pastes the full admin URL with the anchor.

@skorasaurus
Copy link
Member

Still able to reproduce this in Gutenberg 10.9.0.

@skorasaurus skorasaurus removed the Needs Testing Needs further testing to be confirmed. label Jun 24, 2021
@matthiaspabst
Copy link

I can't reproduce this in WordPress 5.9+. Seems like this is fixed now.

@skorasaurus
Copy link
Member

Neither am I able to reproduce; closing.

@matthiaspabst
Copy link

The bug still exists (or exists again?) in WordPress 6.0.2.

@smerriman
Copy link

Just came up against this today myself. Can this be reopened or should I open a new issue?

@skorasaurus
Copy link
Member

skorasaurus commented May 4, 2023

Just came up against this today myself. Can this be reopened or should I open a new issue?

I reopened this but could you share more information about your environment; do you have the Gutenberg plugin installed? Which version of WordPress are you using? I am unable to reproduce this myself in WP 6.2 with Gutenberg 15.6.2 installed.

Video shows that the copied link is reproduced correctly

2023-05-04-error.mp4

@skorasaurus skorasaurus reopened this May 4, 2023
@skorasaurus skorasaurus added the Needs Testing Needs further testing to be confirmed. label May 4, 2023
@smerriman
Copy link

Apologies for the delay - it happened for me 3 times while I was migrating a site the other week, but I can't recall the exact circumstances and now am unable to replicate; I assumed based on matthiaspabst's message that it was happening more generically. Will follow up the next time it happens.

@smerriman
Copy link

smerriman commented May 17, 2023

I've managed to replicate the issue. It now only exists with a cut and paste, rather than a copy and paste.

https://watch.screencastify.com/v/7Bf2BHOZJ9pufLCF1I3K

  • Enter some text, link it to anchor
  • Select it, press Ctrl X.
  • If you press Ctrl-V immediately to re-paste it into the same paragraph, it works
  • However, it you select any other paragraph and paste it, it breaks with the admin URL being appended.

So basically, cut and paste always fails, except if re-pasting immediately where you cut it from.

The link popup appears very buggy while cutting and pasting as well, appearing partially offscreen even though there is no link visible.

edit - for reference, this is WP 6.2.1, no Gutenberg plugin.

@jordesign jordesign added [Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) and removed Needs Testing Needs further testing to be confirmed. labels Jul 10, 2023
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

8 participants