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

Adding a link url via copy/paste doesn't work on previously formatted text #63434

Closed
bph opened this issue Jul 11, 2024 · 6 comments · Fixed by #63779
Closed

Adding a link url via copy/paste doesn't work on previously formatted text #63434

bph opened this issue Jul 11, 2024 · 6 comments · Fixed by #63779
Assignees
Labels
[Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@bph
Copy link
Contributor

bph commented Jul 11, 2024

Description

For some of my content I add a link to text and then bold it. Sometimes, I bold it first and then add the link.
For a while now I noticed that copy/page over a highlight text didn't always work, and I finally chased down the source of this "misbehavior"

If the text is formatted in bold, highlighting and adding the link via copy/paste doesn't work anymore. It does\work when using the link button, but that makes the process two clicks longer.

See below video for illustration.

Step-by-step reproduction instructions

  • Add a paragraph block with text.
  • Highlight a portion of the text
  • Format it in bold
  • Highlight the text again
  • copy/paste a URL. (use https://google.com or any other url)

Screenshots, screen recording, code snippet

Screen.Recording.2024-07-11.at.15.22.38.mov

Environment info

  • WordPress 6.6 RC3 (but it has been there for a while so it's not a WordPress 6.6 issue)
  • Gutenberg 18.7.1
  • Google Chrome Version 126.0.6478.127

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

@bph bph added [Type] Bug An existing feature does not function as intended [Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) labels Jul 11, 2024
@ndiego
Copy link
Member

ndiego commented Jul 16, 2024

Yes, I can confirm. This issue also happens on any previously formatted text. For example, the same thing happens when text is italicized or set to inline code.

@ndiego ndiego changed the title Adding a link url via copy/paste doesn't work on bolded text Adding a link url via copy/paste doesn't work on previously formatted text Jul 16, 2024
@t-hamano
Copy link
Contributor

I was able to reproduce this issue, and it seems to occur when copying and pasting text with some inline formatting.

fa222cded81ed1264aa1494a9de94310.mp4

@t-hamano
Copy link
Contributor

t-hamano commented Jul 20, 2024

I discovered that this problem was caused by the following PR:

Commenting out this conditional statement seems to fix the problem, but it might have some side effects.

Maybe @ellatrix knows something.

@ellatrix
Copy link
Member

@t-hamano do you want to try a PR and see what tests fail?

@rfischmann
Copy link

We have a reusable block in our site that adds a <span> with a specific class and some text inside of it. I also can't select the text and paste a link anymore on WordPress 6.6.

@bph bph mentioned this issue Aug 21, 2024
2 tasks
@t-hamano
Copy link
Contributor

I think this issue was resolved as a result of #63671 and is not reproducible in the latest Gutenberg, so I would like to close it.

I think it will be important to see if we backport the fix for this issue to a WP6.6 minor release. See this comment.

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) [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants