Skip to content

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

Open

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

Activity

  1. added
    [Type] Bug
    [Feature] Saving
    on Dec 25, 2020
  2. added
    [Type] Enhancement
    and removed
    [Type] Bug
    on Dec 26, 2020
  3. annezazu commented on Mar 1, 2021

    @annezazu
    ContributorAuthor

    This also needs to be considered when it comes to the template part editing flow as well. For example, saving changes as a new template part rather than overwriting the current one.

  4. added
    Needs Design
    on Mar 18, 2021
  5. javierarce commented on Mar 29, 2021

    @javierarce
    Contributor

    Maybe I'm missing something, but to me this feels like a bug: after navigating out of the template editing mode, shouldn't the unchecked items be discarded automatically?

  6. annezazu commented on Mar 29, 2021

    @annezazu
    ContributorAuthor

    I'm not quite sure what the intent is :D Good question though. @jameskoster do you have a sense of this?

  7. jameskoster commented on Mar 30, 2021

    @jameskoster
    Contributor

    Yeah I think this is an oversight. I agree with @javierarce – the unsaved changes should be discarded.

  8. changed the title [-]Site Editing: Improve saving flow when dismissing changes[/-] [+]Site Editing: Discard unsaved changes when moving between editing modes[/+] on Mar 31, 2021
  9. annezazu commented on Mar 31, 2021

    @annezazu
    ContributorAuthor

    Awesome. Thank you both! I've updated the issue title and description to be more accurate to the bug that remains.

  10. annezazu commented on Apr 5, 2021

    @annezazu
    ContributorAuthor

    @priethor would you consider this a bug at this point over an enhancement? Wanted to check in first before altering labels :)

  11. priethor commented on Apr 8, 2021

    @priethor
    Contributor

    At this point, it's a fine line dividing both, but I would say it's a bug because I don't believe this behavior was the original intent when designing and developing the feature; it looks like an oversight rather than the original intended purpose (in which case it would be an enhancement because it would indeed be working as expected by those creating the feature).

  12. annezazu commented on May 10, 2022

    @annezazu
    ContributorAuthor

    More usability feedback in general to pass along related to this issue from the fourteenth call for testing for the FSE Outreach Program:

    Still in the template editor I went to view the post. Then trying to get back to the template editor I got the page editor which informed me that there was a saved version that contained changes. (I have been caught by this before – on my own site when making changes in the templates and then going to the page editor, if I had clicked on the revert to saved I potentially might have lost all the changes that I had just tried to make. This is confusing!)

    This continues to be a bit of an awkward flow that would benefit from greater clarity.

  13. annezazu commented on Nov 29, 2022

    @annezazu
    ContributorAuthor

    This was once more mentioned in the FSE Outreach Program's Site Editor Sneak Peek:

    I kept unchecking the box to save the template part, but this preference wasn’t remembered the next time I went to save. I felt like it should remember that (at least until I made another edit to that template part).

  14. annezazu commented on Jan 13, 2023

    @annezazu
    ContributorAuthor

    Noting that this was brought up in the FSE Outreach Program's nineteenth call for testing:

    When switching to another template or template part, there’s no message (alert) about unsaved changes will be lost. I know these are saved “in general”, but I think it would be great to prompt save changes before switching to another template or template part.

  15. annezazu commented on Feb 20, 2023

    @annezazu
    ContributorAuthor

    Noting that this problem also happens with the new "global save" button with browse mode:

    Site.Editor.global.save.button.mov

    @jasmussen @youknowriad as a heads up. Notice I can't discard changes and that the push to Save will persist.

  16. jasmussen commented on Feb 27, 2023

    @jasmussen
    Contributor

    This is a good one to solve. Technically this is mainly surfaced by the new save interface, moreso than being a new issue, insofar as the current way you "discard" changes is you exist the design section without saving. I think this is made especially prominent through the new always visible save button.

    I do agree that discarding changes through an explicit action could be nice to have. Such an option may also, in the future, fit well into a save panel, which I believe @jameskoster and @richtabor have explored some options for, that may be relevant to this conversation. Mainly, once all changes are saved, it seems like the panel could simply say "Saved", just like it does inside the editor.

  17. moved this to 🎨 Needs design in Polishon Apr 28, 2023
  18. added
    [Feature] Site Editor
    and removed on Jul 24, 2023
  19. StevenDufresne commented on Jun 4, 2024

    @StevenDufresne
    Contributor

    I've run into this multiple times as well and find this experience to be very frustrating.

    Here's where I got stuck recently.

    1. I somehow ended up with multiple navigation menus in my list (I probably did it by clicking around in a template)
    2. I clicked on one to delete it.
    3. It randomly gave me an Edit Page window
    4. I clicked "edit"
    5. That somehow made a change that I needed to review
    6. I clicked "Review 1 change"
    7. Not seeing any revert button, clicked "cancel", that closed my window
    8. I clicked "Review 1 change" again
    9. I unchecked "navigation" but now the "Save" button was no longer active.

    How do I revert this change?

    GIFs

    Getting a weird edit for doing nothing
    Screen Capture on 2024-06-04 at 10-46-24 (1)

    Not being able to remove it
    Screen Capture on 2024-06-04 at 10-47-05

    Environment
    Gutenberg version 18.3.0

  20. youknowriad commented on Jun 4, 2024

    @youknowriad
    Contributor

    We definitely need a "revert" button on this modal/save flow. Thanks for the feedback.

  21. removed
    [Feature] Site Editor
    on Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs Design[Feature] Saving[Type] Enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions