Demo 03 · Resume with consent

Manual recovery controls in your application flow

Keep restore and discard actions beside your own headings, consent copy, or step controls. The addon keeps the record private and applies its existing filtering, expiry, cleanup, and status feedback.

Quick facts

Mode
restoreMode: "manual"
Storage
Tab-scoped sessionStorage with a ten-minute expiry
Generated controls
None
Safe result data
Counts and timestamps only; never stored values

Long service request

File selections exist only for this active page session.

Saved-progress controls

Saved progress: Checking availability

Manual-mode recipe

const sessionRecovery = createSessionRecoveryAddon({
  formKey: "service-intake",
  fieldNames: ["fullName", "email", "request"],
  restoreMode: "manual"
});

createFormSubmissionRecovery(form, {
  addons: [sessionRecovery]
});

restoreButton.addEventListener("click", () => {
  sessionRecovery.restoreAvailable();
});

The real buttons above live outside the form and call controller methods directly. The addon does not require recovery markup in manual mode.

Controller methods

MethodResultUse
hasAvailableRecovery()booleanUse this to update an application button's disabled state.
restoreAvailable()counts plus cleared, or falseRestores the filtered values and uses the existing polite restore message.
discardAvailable(){ discarded: true } or falseRemoves the record and uses the existing polite discard message.
saveNow()timestamps/counts, or falseCancels a pending debounce and stores the filtered current values.
clear(){ cleared: true } or falseRemoves saved progress without an extra recovery announcement.

Lifecycle and error handling

Accessibility behavior

Privacy boundaries

The addon uses sessionStorage, a versioned key, the page pathname, a timestamp, expiry, state, and the filtered snapshot. It handles denied or full storage without breaking the form.

The controller never returns the stored record, a snapshot, FormData, response content, or saved values. Use a field allowlist and keep high-risk form storage under dedicated review.

Localization

This demo passes recovery feedback through the addon's messages option. Your application owns the button names; the addon uses the localized restore or discard message in the existing status region. Messages are always inserted as text, not HTML.