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

Text is deleted when undoing a hard break inserted into a heading #11108

Closed
sarahmonster opened this issue Oct 26, 2018 · 5 comments
Closed

Text is deleted when undoing a hard break inserted into a heading #11108

sarahmonster opened this issue Oct 26, 2018 · 5 comments
Labels
[Block] Heading Affects the Headings Block Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended

Comments

@sarahmonster
Copy link
Member

Typing a hard return (Enter) in the middle of a heading, then using command+z to undo deletes everything that appeared after the line break:

2018-10-26 12 41 18

Typing command+z a second time brings the text back.

Using the backspace key instead of command+z undos the line break in the way I'd expect.

I would expect that typing command-z at this stage would just undo the line break I'd inserted, rather than removing the second paragraph entirely. I'm not certain if this is a bug or expected behaviour—I suspect on a technical level, it's undoing the "create new block" first and then the "break heading", but from a ux perspective, it feels unexpected.

To reproduce:

  1. Create a heading.
  2. Type a hard return (enter) in the middle of that heading, breaking the heading into a heading and a paragraph.
  3. Type command+z.
  4. The paragraph of text disappears.
  5. Type command+z again to bring the deleted text back.
@sarahmonster sarahmonster added the [Block] Heading Affects the Headings Block label Oct 26, 2018
@sarahmonster sarahmonster mentioned this issue Oct 26, 2018
7 tasks
@designsimply designsimply added [Type] Bug An existing feature does not function as intended Needs Testing Needs further testing to be confirmed. labels Oct 26, 2018
@carladoria
Copy link

I was able to reproduce this. It seems to only happen with headings. With text blocks, using command+z will revert the action of the broken line (2 blocks created) without deleting the text.

@mrwweb
Copy link

mrwweb commented Oct 29, 2018

I just tested this behavior in a list and found something very similar. In that case it deleted both list items:

list-line-break-undo-bug

This feels related-ish to #11165.

Win 10, Firefox 63, WP 5.0-beta1-43832

@earnjam
Copy link
Contributor

earnjam commented Oct 30, 2018

Paragraph duplicates the portion moved on the first undo, then removes the new block on the 2nd undo.

This gif compares header and paragraph blocks using these keyboard steps:

  1. return
  2. cmd + z
  3. cmd + z

return-undo

I'm using OS X, Chrome 70, WP 4.9.8 and latest from Gutenberg master

@earnjam
Copy link
Contributor

earnjam commented Oct 30, 2018

Related: #8882

List block seems to restore correctly with a single Undo (likely because the return doesn't create a new block), however the cursor gets placed at the end of the line after an undo.

cursor-move-undo

@ellatrix
Copy link
Member

Duplicate of #8882.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Heading Affects the Headings Block Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

6 participants