A long form should not discard an hour of work because the session expired. It also should not submit private data under an identity or organisation that changed while the form was open.
Design session recovery as part of the form's state model. Keep draft persistence, authentication, authorisation, and final submission as distinct steps with visible outcomes.
Decide where draft data may live
Choose whether drafts are stored in memory, browser storage, or an authorised server record. Each choice has different persistence and access implications. Browser persistence can help recovery but requires care on shared devices and when accounts switch.
The MDN session storage reference describes browser storage behaviour. It is a storage mechanism, not a permission boundary or a guarantee that sensitive draft data is appropriate to retain there.
Exercise a fictional proposal form
Imagine a user writes a detailed proposal for organisation Rowan. While the form remains open, their session expires. On submission, the application should preserve the draft under its chosen policy and explain that sign-in is required before the operation can continue.
After reauthentication, verify the same intended actor and organisation, then recheck current access. If the user signs into a different account, do not silently attach Rowan's draft to that account. Offer a clear path consistent with the product's data policy.
Test unchanged permissions, downgraded permissions, removed membership, another account, another organisation, and a browser reload. Check the visible draft and the stored result. A recovered form is useful only if the final data reaches the correct owner.
Distinguish an expired session from an uncertain submission
If the server rejected the request before any write, retrying after login is straightforward under the normal duplicate policy. If the write succeeded but the response was interrupted, the application needs a way to identify that existing submission before creating another.
Use a stable submission identity or equivalent application mechanism appropriate to the workflow, and test repeated clicks and network interruption. Explain whether the result is saved, pending confirmation, or unsaved. A generic “something went wrong” invites users to submit repeatedly.
The tradeoff is recovery convenience versus retained private data and state complexity. Autosave can be valuable, but it creates deletion, account-switching, and conflict questions. For a narrow pilot, a simpler explicit save-draft step may be preferable if users understand its limits.
The StackFlight portfolio account offers related authenticated-form context. Rowan's proposal form is fictional and does not describe a reported product incident.
Questions about session expiry in forms
Should login automatically resubmit the form?
Only after identity, intended organisation, current permission, and duplicate state are clear. A confirmation step may be appropriate for consequential actions.
Is browser storage always safe for drafts?
No. Evaluate the data, device-sharing context, retention, and account-switch behaviour. Storage persistence alone says nothing about appropriateness.
What should be tested first?
Expire a session with a populated fictional form, sign in as a different account, and inspect recovery behaviour. Bring ambiguous states to a form-workflow review.