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

Undo in Title or Tagline block positions caret at start of field #64724

Open
2 tasks done
ironprogrammer opened this issue Aug 22, 2024 · 0 comments
Open
2 tasks done
Labels
[Block] Post Title Affects the Post Title Block [Block] Site Tagline Affects the Site Tagline Block [Type] Bug An existing feature does not function as intended

Comments

@ironprogrammer
Copy link
Contributor

Description

After Undo (Cmd+z) of a paste in the Title or Tagline block, the caret is (visually) positioned at the start of the field. However, subsequently pasted text is inserted at the end of the field, which is not expected based on caret position.

Expected behavior after Undo would be for:

  • The caret to be positioned where it was prior to the last "undid" action, instead of defaulting to the start of the field.
  • Pasted text to appear where the caret is positioned.

In testing a related issue, #64665, @Mamaduka also indicated:

...after digging, it turned out to be a general bug with the RichText component. The same behavior can be reproduced with Tagline block.

Problem

  • RichText only "knows" how to re-adjust selection after undoing for block attribute values.
  • When undoing entity properties, selection will point to the old start and end.

Step-by-step reproduction instructions

  1. Add a new post or page.
  2. Select the Title block and enter a title.
  3. Paste additional text into the end of the field.
  4. Undo the paste with Cmd+z/Ctrl+z (using the editor toolbar Undo button changes focus from the field, so is n/a).
  5. Observe the location of the caret after undo (🐛 caret is moved to start of field).
  6. Without clicking or repositioning the caret, re-paste into the field with Cmd+v/Ctrl+v.
  7. Observe where the pasted text is inserted (🐛 text is inserted at end of field).

Screenshots, screen recording, code snippet

title-paste-caret-front
Demonstration of pasting text and resultant caret position. After Undo of paste caret appears to be at front but pastes at the end of the field.

Environment info

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
@ironprogrammer ironprogrammer added [Type] Bug An existing feature does not function as intended [Block] Post Title Affects the Post Title Block [Block] Site Tagline Affects the Site Tagline Block labels Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Post Title Affects the Post Title Block [Block] Site Tagline Affects the Site Tagline Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

1 participant