Unsaved changes

Hi. My client has asked me to look into warning editors when they move away from a changed page with something like "You have unsaved change, do you want to discard them?"

I see an number of people have written about in, here's an example? Has anyone looking into adding this to Volto?

Not quite the same feature, but related: A lot of work was done toward adding a feature to put unsaved changes in localstorage if the user closes the window or navigates away without saving, and then provide a way to restore the unsaved changes. At the bottom of this ticket's discussion is a summary of what was decided when the Volto team discussed it, and some remaining things to adjust. Save edit form as draft using localStorage by tiberiuichim · Pull Request #4252 · plone/volto · GitHub

That was a long discussion (in the GitHub issue) :smiley: It seems simpler to me to warn the user and let them decide what to do rather than to (over?)engineer a solution.

@tkimnguyen I suspect that some engineering will be required, in order to correctly determine whether the editor has made changes, and to hook into both normal browser unloads as well as navigation via the Volto router. But yeah, a simple warning does sound simpler to implement than the recover-unsaved-changes feature from that ticket.