Make WordPress Core

#57941 closed defect (bug) (invalid)

CTRL+V paste shortcut used for placing a link

Reported by: thomask's profile thomask Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Editor Keywords: 2nd-opinion
Focuses: Cc:

Description

In Gutenberg, if you have something selected text and do standard CTRL+V (with text in clipboard), it does not replace selected text as any other windows program in history would do, but it creates a link with the clipboard as the URL address. This goes against all good programming practices.

If i may recommend - i would go to e.g. CTRL+SHIFT+K (as CTRL+K is standard Add link shortcut), or even better - if it is possible to detect the content of the content of the clipboard - the standard CTRL+K might be used in cases, when there is a URL or email address in the clipboard (with adding mailto: for email).

Change History (3)

This ticket was mentioned in Slack in #core-editor by tobifjellner. View the logs.


16 months ago

#2 @costdev
16 months ago

  • Keywords 2nd-opinion added; needs-patch removed
  • Version trunk deleted

Hi @thomask, thanks for opening this ticket.

For URLs/email addresses, the text became a link which linked to the URL/created a mailto: link. It's quite common now to create a link on paste. This is done in Slack, GitHub and Edge (by default), to name just three that came to mind at the time of writing.

In addition:

  • This is the same behaviour when pasting over selected text with the Classic Editor plugin active.
  • It's generally recommended not to use raw URLs, but to link descriptive text to a URL. For this reason, linking the selected text on paste is the more visually friendly and accessible approach for web pages.

  • Removing needs-patch and adding 2nd-opinion to gather thoughts on this.
  • Removing trunk, as this has existed since before WordPress 6.2.

#3 @azaozz
16 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

if you have something selected text and do standard CTRL+V (with text in clipboard), it does not replace selected text as any other windows program in history would do, but it creates a link with the clipboard as the URL address

Yes, in the editor (and even in the old editor) pasting "over" any selection will create a link with the selection as the linked text/image. That happens only if the clipboard content is an URL (or something that looks very much like an URL). This is a feature, not a bug :)

As @costdev explained above, this is how many other online editors work, and is an easy, very convenient way to create simple links (no popups, no dialogs, no buttons to click, etc.). This feature has been in the WordPress editors for 5-6 years I think.

Closing as "invalid" as this is the expected behavior. Feel free to reopen if there are good reasons to change this behavior.

Note: See TracTickets for help on using tickets.