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

Classic block content not saved until block is blurred #22935

Closed
johngodley opened this issue Jun 5, 2020 · 1 comment · Fixed by #23408
Closed

Classic block content not saved until block is blurred #22935

johngodley opened this issue Jun 5, 2020 · 1 comment · Fixed by #23408
Assignees
Labels
[Block] Classic Affects the Classic Editor Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@johngodley
Copy link
Contributor

johngodley commented Jun 5, 2020

Content in a classic block is not saved until the block is blurred. This is different behaviour to other blocks, where content is saved immediately (and by 'saved' I mean the block content is saved outside of the block).

This could lead to a loss of content if a classic block is used and something happens where the window is closed before a blur event happens (i.e. the user closes the window, or Gutenberg crashes).

This also affects the beforeunload protection, which is not enabled until the blur occurs.

This was tested in Gutenberg 8.2.1 using MacOS Chrome.

Steps to reproduce

  • Create a new post

  • Add a classic block

  • Enter some content into the block, but don't click outside of it
    image

  • Check the ‘application’ tab in the developer console and note that the Session Storage autosave does not contain content from the block
    image

  • When the post is autosaved, note that the database contains a draft post with no content
    image

  • Click out of the block and note that the session storage now contains the content of the classic block, and this is eventually saved to the database.

  • Click the 'save draft' to save the post

  • Re-edit the classic block and make some changes. Note how the save status still shows 'saved', and doesn't change to 'save draft'

  • Click out of the block and note how the save status now changes to 'save draft'.

  • Re-edit the classic block, make some changes, and then close the window - no browser beforeunload warning is shown

Contrast this to a paragraph block:

  • Create new post
  • Type into paragraph block and don't click out of the block
  • Note the session storage contains the block content
  • Note the database contains the content
  • Save as draft
  • Reedit the paragraph and don't click out of the block
  • Note the save status is showing 'save draft'
@johngodley johngodley added [Type] Bug An existing feature does not function as intended [Block] Classic Affects the Classic Editor Block labels Jun 5, 2020
@glendaviesnz glendaviesnz self-assigned this Jun 24, 2020
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jun 24, 2020
@glendaviesnz
Copy link
Contributor

Similar to #15577

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Classic Affects the Classic Editor Block [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.

2 participants