Skip to content

Drafts: save contents of the text field to local storage/server-side user-specific storage #1446

Open
@urbansheep

Description

@urbansheep

There's a common issue of losing typed text in the form field (post or comment) when browser state is somehow disturbed by browsing away, reloading or crashing/offloading on mobile devices. This brings a certain amount of frustration in users and is usually mitigated by a number of solutions:

First layer of persistence: local storage, where draft can be kept as text after a certain amount of seconds or type events has occured, along with page URL/text container ID. With URL or text container ID we could restore lost state from the drafts buffer after page reload or browser crash, automatically when browser enters the same page and/or activates a certain container (post or comment form).

Multiple drafts could be introduced, but it doesn't seem feasible due to added interface complexity. So the first solution should be rather basic and help with most common case of losing most recently typed text.

Use case:

  1. User activates a post form, types some text.
  2. User navigates away or loses browser state somehow (bypassing unload alert).
  3. User comes back to the page and activates the very same post form.
  4. Post form is autofilled from the local draft, if one is found. Copy of the text stays in the buffer.
  5. After a while unclaimed drafts are discarded.

Edge cases:

  • If text field already contains some text (saved by browser state), it should not be automatically overwritten.
  • If user had several unsaved posts/comments, in basic case with a single draft buffer they would be overwritten by each other in the draft storage, unless each of them is saved to local storage as indexed list, bound to posts/threads by ID.

Second layer of persistence: server-side drafts. This could be deployed as an addition to user-settings storage, with an option to select from a fixed number of last saved drafts, synced from/to local storage occasionally.

While significantly more complex, server-side drafts would allow users to keep their drafts across sessions and devices, and feel safe even on the go when connection is unstable.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions