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

Gutenberg corrupts #HREF/anchor links randomly but consistently, inserting extra # #22173

Closed
adamgit opened this issue May 7, 2020 · 5 comments
Labels
[Status] Needs More Info Follow-up required in order to be actionable.

Comments

@adamgit
Copy link

adamgit commented May 7, 2020

Describe the bug
There are some serious problems with the handling of Anchor links already (c.f. Issue #16165), but here's another: sometimes - and 100% of the time for particular strings - Gutenberg replaces what the user typed and what was saved with different text with an extra "#" symbol on the front (i.e. two # symbols instead of one), which corrupts the link and forces broken links. Once this happens it is literally impossible to include a link in a page - Gutenberg keeps corrupting it.

To reproduce
Steps to reproduce the behavior:

  1. Select a complete Heading para
  2. In Advanced tab copy/paste a string to the HREF/anchor field
  3. Select something else (to make sure the field above accepts the input. This seems to be a separate bug that sometimes Gutenberg "forgets" what was pasted - I assume this is because of the async code behind the scenes)
  4. Come back and copy the string out of the HREF/anchor field (if there were any spaces, they've now been convertd to dashes)
  5. Select some text somewhere in a paragraph on the page
  6. Press the link button
  7. Type a # symbol into the link box, then paste in the anchor-text
  8. Press the return button - OR - type return/enter on keyboard (tried both, bug happens with both)
  9. Check the link - it's correct on mouseover
  10. Check the link by editing it - it's still correct
  11. Update page, open in browser - link is now corrupt

I have a page of links and this happens about one time in 30 or so. I cannot see any pattern for the text that causes it, but here's a current example:

"#FAQ:-The-XR-Plugin-Management-tab-is-missing-after-installing-the-package?"

...copy/pasted directly from the Gutenberg editor, and visible as that in the editor, then is output to the raw HTML as:

"##FAQ:-The-XR-Plugin-Management-tab-is-missing-after-installing-the-package?"

Note the extra #. Nothing gets rid of this, Gutenberg keeps putting it back in.

Note: Other text that appears almost identical has no problems, works the other 29 times in 30. e.g. here's one that Gutenber does NOT corrupt: "#FAQ:-Pre-launch-support-forum-thread?"

By trial and error, I've found that inserting a few random extra characters into the link, or removing a few, often causes this bug to go away. But it takes lots of attempts. NB: it's not a special character, simply deleting a plain letter in the middle of a word is sometimes enough to "fix" it.

Expected behavior
A clear and concise description of what you expected to happen.

Gutenberg should not be rewriting links when it saves / outputs them! It should be using the text in editor!

And also: even if it is going to rewrite data, it shouldn't insert fake # symbols into linkings, breaking them :).

Screenshots
If applicable, add screenshots to help explain your problem.

Editor version (please complete the following information):

  • WordPress version: 5.3.2
  • Does the website has Gutenberg plugin installed, or is it using the block editor that comes by default? "default"
  • If the Gutenberg plugin is installed, which version is it? N/A

Desktop (please complete the following information):

  • OS: Windows
  • Browser Firefox
  • Version 76.0

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context

@talldan talldan added the [Status] Needs More Info Follow-up required in order to be actionable. label May 8, 2020
@talldan
Copy link
Contributor

talldan commented May 8, 2020

@adamgit Thanks for providing so much information, but the reproduction steps aren't clear enough.

It's helpful if you can provide a numbered list of very basic steps to reproduce the issue.

What seems to be missing is where in the user interface you're pasting the link, so if you could update the description that would be very helpful. My first instinct was that this was related to adding links to paragraph text, but the linked issue (#16165) is related to the HTML Anchor field, so perhaps it's that.

@adamgit
Copy link
Author

adamgit commented May 8, 2020

Ah, I see what you mean. I don't know where the problem is happening, could be either or both. Will update now

@talldan
Copy link
Contributor

talldan commented May 8, 2020

Thanks for updating the description!

@adamgit
Copy link
Author

adamgit commented May 8, 2020

Also, minor addendum: I've been experiencing this problem for a month, and trying everything I could think of to narrow it down. But I just can't find any pattern in when it happens. If there's anything else I can do/try next time it occurs to get more data, let me know

@youknowriad
Copy link
Contributor

Not able to reproduce as well. I suspect it's related to other plugins potentially.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Needs More Info Follow-up required in order to be actionable.
Projects
None yet
Development

No branches or pull requests

3 participants