Classic block content not saved until block is blurred #22935
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
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
Check the ‘application’ tab in the developer console and note that the Session Storage autosave does not contain content from the block
When the post is autosaved, note that the database contains a draft post with no content
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 shownContrast this to a paragraph block:
The text was updated successfully, but these errors were encountered: