Closed Bug 773672 Opened 11 years ago Closed 11 years ago

When leaving a page and coming back, restore previous content rather than warning the user before leaving

Categories

(developer.mozilla.org Graveyard :: Editing, defect, P2)

defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: callahad, Assigned: davidwalsh)

References

Details

(Whiteboard: s=2012-08-22 p=2 s=2012-08-29)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:16.0) Gecko/16.0 Firefox/16.0
Build ID: 20120706075126

Steps to reproduce:

Sometimes I accidentally trigger the Back function in my browser when editing a document on MDN. I then quickly go Forward to get back to editing.


Actual results:

All of my in-progress changes were gone.


Expected results:

A prompt to restore my in-progress changes, like with MindTouch, would be very, very nice.
Raymond: Can you confirm on developer-new? Can you confirm on multiple browsers -- I think some preserve form contents in these circumstances.
Blocks: 756266
Priority: -- → P2
Whiteboard: s=2012-08-22
Summary: In-progress edits not restored when navigating back then forward → When leaving a page and coming back, restore previous content rather than warning the user before leaving
Whiteboard: s=2012-08-22 → s=2012-08-22 p=2
There's some code in place for this, going to continue it now.

Quick FYI -- we'll likely need to experiment with this.  *Storage interactions are synchronous, so we'll have to be careful not to sow the user down too much while writing and saving at the same time.
Whiteboard: s=2012-08-22 p=2 → s=2012-08-22 p=2 s=2012-08-29
From notes I took from TXJS:

* localStorage may slow down portions of your site, but the parts you are most worried about may not be a problem at all.
* Benchmark your JavaScript with [jsPerf](http://jsperf.com/).
* Best practices
    * Use window.onunload to store values after the user leaves.
    * Do not block the UI. Defer using localStorage until unload.
    * Do not save text entry in localStorage after every keystroke. Wait some length of time before saving.
I'm skeptical about onunload but we'll give it a shot
Assignee: nobody → dwalsh
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/bbb83cbb3a818da3ab2fbf453c3142773488b1a0
fix bug 773672 - Allow restoring of drafts when user leaves page

https://github.com/mozilla/kuma/commit/0a03c9b596ad5320981d84663fa7b6c02d7d756b
Merge pull request #547 from darkwing/localstorage-content-773672

fix bug 773672 - Allow restoring of drafts when user leaves page
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
verified fixed https://developer.allizom.org/en-US/docs/HTML
Status: RESOLVED → VERIFIED
This is fantastic. Really, really wonderful UX.
Version: Kuma → unspecified
Component: Docs Platform → Editing
No longer blocks: 756266
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.