-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
What problem does this address?
The navigation editor currently doesn't warn if a users attempts to exit without saving.
There are a few instances this may happen:
- A user makes some changes, and navigates away
- A user makes some changes and switches to a different menu
- A user makes some changes and creates a new menu
Some of the challenges here are because the menu screen allows users to edit multiple menus without reloading.
On the same topic, the screen also allows users to repeatedly save even if there are no unsaved changes, so it seems there's currently no detection of unsaved changes at all.
What is your proposed solution?
Step 1 - Detect unsaved changes, and only enable the save button when there are unsaved changes.
Implement detections of unsaved changes. In the nav editor I think there are two 'entities' that an be edited - the navigation post and the menu. This would need to be double-checked, but hopefully it should be possible to use the entity system to check for edits.
Then make the save button 'disabled' when there are no edits.
Step 2 - Warn the user if they navigate away
The user should always be shown a 'confirm' warning if they try to navigate away.
Step 3 - Handling saving for multiple menus
The screen could also borrow from the other editors and allow the user to save multiple menus at once, a bit like editing reusable blocks in the post editor or template parts in the site editor:
Alternatively the screen could use the 'confirm' warning when switching menus or creating a new menu if there are unsaved changes.