Skip to content

Site Editing: Discard unsaved changes when moving between editing modes #27896

Description

@annezazu

Describe the bug

When switching between the post editor and template editing modes, the changes aren't properly discarded.

To reproduce
Steps to reproduce the behavior:

  1. Install Gutenberg 9.6+ and a FSE ready theme.
  2. Go to Posts > Add New
  3. Make some changes to the post > Publish or Save Draft
  4. Use the option to edit the template to switch into template editing mode in the document settings section.
  5. Make some changes to the header, footer, and post content.
  6. Select "Apply" and only select the changes to the post content to save. Confirm that decision
  7. You'll then be brought back to the post editor but see "Update" instead of "Publish"
  8. If you select "Update", it then brings you to a screen to save the changes previously not selected in the various template parts. There's not a way to dismiss these and if you try to navigate away, you're notified that you'll lose changes.

Expected behavior

I expect changes to be discarded.

Screenshots

Here's a short video talking through this experience: https://cloudup.com/ckTQ5chiQWM

Editor version (please complete the following information):

  • WordPress version: 5.6
  • Does the website has Gutenberg plugin installed, or is it using the block editor that comes by default? Gutenberg
  • If the Gutenberg plugin is installed, which version is it? 9.6.2

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: Chrome
  • Version:87.0.4280.88

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions