Bug with copying local anchor links in edit mode
-
Hi,
I discovered an issue with copying links that refer to local anchors. When I edit a page in the web browser and copy text with a link holding a reference to a local anchor, then the link breaks after pasting.
Example:
I am in editing mode, WYSIWYG mode, in a web browser: I copy a text-link with target=”#anchor-a”. The copy will not link to “#anchor-a” anymore, but the link will have been rewritten to something like “https://myblog.wordpress.com/wp-admin/post.php?post=123&action=edit#anchor-a”.
Once you know it, it’s not a real problem, you just have to edit all links after copying them. To me, this costs additional time, is still manageable though, but for community members who are not fit with HTML it might be an unsolvable nuisance.
So if you find time, maybe fix this, please.
Thank you. -
Hi there,
Can you give me a link to a post or page on your site where this is happening, and also indicate for me where on the page the link going to an anchor id appears?
Are you using the WP-Admin editor to edit your posts, or the default editor at WordPress.com/posts?
-
Hi, this issue occurs e.g. here
https://wp.me/PbHkTh-a7Feel free to open the page and try to copy a link with an anchor.
I use WordPress.com to edit pages, not the App.
-
-
Thank you for those references. We are still having difficulty recreating the issue you are describing.
If it’s not too much to ask, could you create a list of steps that you are taking along with a little more detail within each step to help guide us through what you are doing?
-
Hi,
Sorry for the late reply.
I have built a playground page and invite you to edit and play with it.
STEPS TO REPLICATE THE BUG:
1. Edit https://rc-scene.com/?page_id=2610
2. We have got a grid with 2 columns here. The left side of the grid holds a list. The text in the list items points to internal anchors.
To give an example: Text “Anchor A” points to “#anchor-a”.3. Mark text “Anchor A” with the mouse, press CTRL+C and paste it into the empty list on the right side of the grid.
4. Npw, check the link of the copied text: It has changed from “#anchor-a” to “https://abc.wordpress.com/wp-admin/post.php?post=2610&action=edit#anchor-a”.
That’s what I call a bug.
Feel free to copy links B and C, it will always result in the same issue.
I used Google Chrome today, but it didn’t work correctly in other browsers either. The URL I saw while editing was “https://wordpress.com/block-editor/page/rc-scene.com/2610”.
Thank you for your support!
Kind regards :))
-
Hi,
I don’t think that the anchors were designed to be used this way.
For this to work correctly, you will want to add the anchors to Headings and then link them to your list on the top of the post.Here are full instructions on that:
https://wordpress.com/support/splitting-content/page-jumps/
It should work correctly.
-
Hi,
Attaching an anchor to a headline, as described in the link you provided, does not make a difference. Why shoudl it? The problem are NOT the anchors, but copy & pasting of text pointing to anchors.
If you think that copy and paste was not designed to function, then please let have a a colleague of yours a look at it. He/She will hopefullly understand that this is an embarassing bug and log it as a bug for the dev team. Thank you.
-
Interesting, I wonder if the browser is replacing what should be a relative URL
#anchor-awith an absolute URL for the page being viewedhttps://abc.wordpress.com/wp-admin/post.php?post=2610&action=edit#anchor-aI wouldn’t call that great, but theoretically I wouldn’t call it unexpected either.
With that said though, I can’t reproduce the problem as described under Firefox 76.0.1.
What version of Chrome are you using?
-
Hmm… On my machine, Win10 and all browsers x64 this issue appears in Chrome 83.0.4103.61, in Firefox 76.0.1 and in Edge Chromium 83.0.478.37.
I deactivated all browser extensions in Edge, and tested again, but to no avail.
The only thing that interferes with web traffic would be Kaspersky Anti Virus (even through I did not activate its brwoser extensions I see that it still blocks certain ads), but it would seem awkward to me if Kaspersky messed with this single feature while everything else seems so be working as it is supposed to.
As mentioned before, once you know about it, and learnt how to fix it, it’s not like screamig for a hotfix. ;-D
Since copying http-links works, and copying anchors doesn’t – at least on my machine – I still call it a bug.
I get the same result on wordpress.org self-hosted websites. Should I post my experience there?
Kind regards!
-
-
Hi there,
What you’re describing is an issue with the Block editor and therefore you need to report to the WordPress.org community.
I have searched the GitHub repository for that issue and I was able to find this one:
https://github.com/WordPress/gutenberg/issues/21112
If this is the same one as the one you’re describing you can subscribe to it and monitor its status.
If it’s not the same you can create a new ticket.
-
Thank you fstat,
That’s exactly the same issue and I am super happy someone else recorded his screen and so provides a way better explanation than I could have done.
I registered with GitHub and subscribed for e-mail notifications whenever a release was published.
Thank you!
-
- The topic ‘Bug with copying local anchor links in edit mode’ is closed to new replies.