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

Safari – pasting text into title doesn't work as expected #51047

Closed
Tracked by #53305
marekzelezny opened this issue May 29, 2023 · 9 comments · Fixed by #64671
Closed
Tracked by #53305

Safari – pasting text into title doesn't work as expected #51047

marekzelezny opened this issue May 29, 2023 · 9 comments · Fixed by #64671
Assignees
Labels
Browser Issues Issues or PRs that are related to browser specific problems [Feature] Paste [Package] Block editor /packages/block-editor [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@marekzelezny
Copy link

Description

When pasting a text into title, the copied text is pasted in combination with a copy of title at the end of title. This happens only in Safari while using CMD+V. Using paste from menubar works fine.

Step-by-step reproduction instructions

  1. Open edit screen for any post
  2. Use CMD+V to paste a text into title (like: 'test' between Hello and World)
  3. Result is: Hello world!testHello world!

Screenshots, screen recording, code snippet

screenrecord.mov

Environment info

  • WordPress 6.2.2, Twenty Twenty-Three (clean install)
  • No active plugins
  • Safari 16.4

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

@Thelmachido Thelmachido added [Type] Bug An existing feature does not function as intended [Package] Keyboard Shortcuts /packages/keyboard-shortcuts [Package] Block editor /packages/block-editor Needs Technical Feedback Needs testing from a developer perspective. labels May 31, 2023
@richtabor
Copy link
Member

richtabor commented Jun 1, 2023

I've noticed this as well; even with selecting all/pasting a whole new title in.

@richtabor richtabor added this to Polish Jun 1, 2023
@richtabor richtabor moved this to Needs development in Polish Jun 1, 2023
@murshed
Copy link

murshed commented Jun 22, 2023

Got the same on the post/page Title

Image

@megane9988
Copy link
Contributor

megane9988 commented Jul 7, 2023

I got same.

  • macOS 13.0(22A8380)
  • Safari 16.1 (18614.2.9.1.12)
safari-title.mov

@lukasbesch
Copy link

I noticed the same issue. Additional information:

The cursor position before the paste does not matter, the result is always the same as described above.
After pasting, the cursor position is at the beginning (before the first letter).

My testing environment:

  • macOS 12.6.5 (21G531)
  • Safari 16.5 (17615.2.9.11.6, 17615)

@MatzeKitt
Copy link
Contributor

It’s not only pasting, also copying doesn’t work as expected.

  1. Write "This is a test" as title
  2. Mark the word "test" by double-clicking on it
  3. Press ⌘ + C to copy it
  4. Paste the clipboard content with ⌘ + V inside the editor’s content (or anything else)

Expected: the word "test" is pasted.

Current behavior: The whole title "This is a test" is pasted.

You can also see via clipboard manager that the whole title is inside the clipboard manager instead of just the one word.

@t-hamano t-hamano added the Browser Issues Issues or PRs that are related to browser specific problems label Feb 24, 2024
@Kuuuzya
Copy link

Kuuuzya commented Apr 8, 2024

Hi everyone. Sorry, didn't noticed this ticket. If there any updates or fixes? Maybe someone know, how to fix it in Safari, cause using other browser on Mac is not to convenient :(

@ironprogrammer
Copy link
Contributor

Today I dug a little deeper into this behavior, and it appears to affect WP back to 6.1. Not to say it's been an issue since the 6.1 release, but does affect the handling of ⌘+V since reported with Safari 16.4.

Reproduction Report

Environment

  • Hardware: MacBook Pro Apple M1 Pro
  • OS: macOS 14.4.1
  • Browser: Safari 17.4.1, Google Chrome 123.0.6312.124, Mozilla Firefox 124.0.2
  • PHP: 8.2.18
  • MySQL: 8.0.27
  • WordPress: 6.6-alpha-57778-src, 6.5.2, 6.0.2

Actual Results

Additional Notes

  • It's notable that after pasting with ⌘+V in Safari, the carat is positioned at the start of the title. This is unexpected behavior for pasting operations, where the carat should be at the end of the pasted text.
  • Could not reproduce in Chrome or Firefox.

Supplemental Artifacts

Here are animated GIFs for tested versions:

6.5

title-test-65

6.4

title-test-64

6.3

title-test-63

6.2

title-test-62

6.1

title-test-61

@Mamaduka
Copy link
Member

When pasting in the Safari post title, I noticed that the RichText value's start and end properties are undefined. This is the reason for unexpected paste behavior. Emulating the same in Chrome will give us the same results:

It can be run via the DevTools console in the editor

const value = { ...wp.richText.create( { html: 'Hey' } ), start: undefined, end: undefined };
const newValue = wp.richText.insert( value, wp.richText.create( { html: ' There' } ) );

// { text: 'Hey ThereHey' }
console.log( newValue );

Screenshot

CleanShot 2024-08-21 at 06 49 52

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Aug 21, 2024
@Mamaduka
Copy link
Member

Here's the fix - #64671.

@github-project-automation github-project-automation bot moved this from Needs development to Done in Polish Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Browser Issues Issues or PRs that are related to browser specific problems [Feature] Paste [Package] Block editor /packages/block-editor [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.