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

Open
bph opened this issue Jul 11, 2024 · 5 comments · May be fixed by #63779
Open

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

bph opened this issue Jul 11, 2024 · 5 comments · May be 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?

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jul 21, 2024
@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.

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