Save draft details when creating a work item
Summary
Currently when creating a work item, leaving the creation context results in any draft data being lost. In legacy issues/epics, we persist the text until cancel or submit.
Legacy items also persist select fields, such as due date and weight, but not all fields. This makes it less obvious what data is persisted and could lead to users not realizing there's draft data in the sidebar.
Proposal
In order to set effective expectations, and avoid unintended data loss, we should persist entered details in the work item creation form as a local draft. When re-opening the creation form, the draft repopulates the form.
"Cancel" or "Submit" clear the draft in all cases.
Separate follow ups
-
Add UI confirmation on "Cancel" or Close when data is present: #468469 (closed)
-
Explore full drafts: #17223
Original exploration of draft strategies
A - Preserve all data: Store all draft values including selected fields, and restore them when reopening the modal. * While today this persists longer, this could be scoped to only the page session (i.e. not localstorage) — this would still enable a user to close and reopen the modal, for instance if they needed to copy or check a value from the underlying page. * If this persists beyond the page session this will get complicated by Project selection, i.e. if your draft is in Tree > Orange and you open "New" from Tree > Apple, what happens? Without a draft the project would be set to "Apple", but could be changed in many/all cases. Likewise if the draft is for "issue" and the user directly opens "new epic", what happens to the draft? Tying drafts to type would create an unexpected state as a user if a draft was to suddenly appear when changing types.
B - Discard drafts, add friction: Don't store draft data, but make it more clear when data will be lost — closing the modal triggers a confirmation, closing the page triggers a browser "unsaved data" warning.
C - Save drafts as draft objects: Save all data as it's entered to a draft object which exists until removed/saved, and is accessible only to the user via some sort of "Drafts" list. This would function similar to drafts in Gmail.