# Destructive actions

> Kwark prefers Undo to "Are you sure?", keeps deleted stories in the trash for 30 days, and asks only before something that cannot be undone or that changes what other people can see, naming exactly what will go.

Source: https://kwark.space/designSystem/patterns/destructive-actions

## The problem

A writer tidying her library at midnight deletes the wrong story. Or a producer removes an actor from the project five minutes before the actor needs tomorrow's call sheet. Or an owner taps "Remove cover" and the poster she made goes black.

Two opposite failures sit here. A tool that asks "Are you sure?" before everything trains people to click Yes without reading, so the one dialog that matters is ignored. A tool that asks before nothing loses work. Kwark's principle 12 is that the work is never at risk; principle 9 is that Kwark is quiet. Destructive actions have to serve both.

## Kwark's answer

### Undo first, confirm rarely

Choose the gentlest form that keeps the work safe:

| The action | Form | Example |
|---|---|---|
| Reversible, affects only you | Do it, then a toast with **Undo** | Remove cover: "Cover removed." with Undo, no dialog (Decision 0017) |
| Reversible for 30 days | Move to trash, with a toast | **Move to trash**, "Moved to trash", restore from the trash drawer |
| Changes what other people can see or do | A confirm that names who and what | "Remove Dev?" / "They lose access straight away and "Blank Pages" leaves their library. Their comments stay. You can add them again later." |
| Cannot be undone | A confirm that names exactly what goes, says "This cannot be undone", and uses the action as the button | "Delete this story for good?" **Delete for good** |
| Replaces the writer's own work | A confirm with a way to keep theirs | Pitch: "Replace this treatment with the outline's beats?" **Replace** / **Keep mine** |

### The trash

Deleting a story moves it to the trash. The trash says: "Kept here for 30 days, then deleted for good. Restore brings a story back." An empty trash says "Nothing here" and "Stories you delete stay here for 30 days." Scenes removed from a script can be restored from Trash for 30 days too.

From the trash, **Delete for good** and **Empty trash** are the only irreversible actions on a story, and both confirm:

- "Delete this story for good?" / ""{name}" and everything in it will be deleted from this device and the cloud. This cannot be undone." **Delete for good**
- "Empty the trash?" / "{n} stories and everything in them will be deleted for good, from this device and the cloud. This cannot be undone." **Empty trash**

If it does not work, nothing is lost and the words say so: "This project could not be deleted just now. It is still in the trash." "The trash could not be emptied just now. Nothing was lost." A story shared with you is not yours to delete; hiding it says "Shared with you and not deleted. Whoever shared it still has it."

The audit found the old empty-trash deleted the cloud project at once, in one large batch that could fail halfway. The 30-day trash and smaller batches came from that finding.

### Removing people

Removing someone changes another person's work, so it confirms, and the message says what they keep:

- Joined: "Remove {name}?" / "They lose access straight away and "{title}" leaves their library. Their comments stay. You can add them again later."
- Invited, not joined: "Cancel the invitation to {email}?" / "Their address comes off the list, and the project will not appear when they sign in."
- Cast and crew: "Take them off this project?" / "They stay in your directory and on other projects. Only this film's roster changes." **Take them off**
- Leaving a project you were invited to: **Leave project**.

A person who was removed sees a named "access ended" page, never "the project has been deleted" (Decision 0042).

## Anatomy of a confirm

| Part | Rule |
|---|---|
| Title | A question that names the thing: "Delete this story for good?", "Remove Dev?" |
| Message | Exactly what goes, from where, and what stays. "This cannot be undone." only when true. |
| Safe button | Quiet, first, focused by default: **Keep** or **Cancel** |
| Destructive button | The action as its label, in danger style: **Delete for good**, **Empty trash**, **Remove access** |
| No icon theatre | No pulsing shield, no glow, no coloured stripe. The legacy `ConfirmDialog` has these; the system does not. |

## Rules

- **Must** offer Undo for any reversible destructive action, in a toast that stays 8 seconds and pauses on hover or focus.
- **Must** move stories to a trash that keeps them 30 days, and say so where the trash is.
- **Must** confirm before anything that cannot be undone, and before anything that changes what other people can see or do.
- **Must** name the thing, the scope ("from this device and the cloud") and what survives ("Their comments stay").
- **Must** label the destructive button with the action. Never "Yes", "OK", or the legacy default "Yes, do it".
- **Never** confirm a reversible action. A dialog before Remove cover is noise.
- **Never** delete in one unbounded batch; work in batches that can resume, and say what happened if one stops.
- **Never** use a confirm to scare: no red header bars, pulsing icons, capitals or exclamation marks.
- **Always** put the destructive item last in a menu, after a separator, in danger text.
- **Always** focus the safe choice first in a confirm, so Enter does not destroy.

## Edge cases

- **A shared project in your library.** You can hide it or leave it; you cannot delete it. The words say the owner still has it.
- **Undo after navigating away.** The toast's Undo still works while the toast is visible; after that, restore from the trash.
- **Deleting a scene the schedule uses.** The strip leaves the board and the call sheet's draft changes; issued revisions are frozen and do not change (Decision 0020).
- **Offline.** A trash move happens on the device at once and syncs later. Delete for good waits for the cloud and says it will.
- **Bulk.** "Empty trash" counts what will go in the message. Twenty stories are named as "20 stories", never hidden behind "items".
- **Replacing work with generated structure.** Always keep the writer's version reachable (**Keep mine**, or a restore point taken first).

## Phone and desktop

On a phone, destructive actions live in a row's ⋯ sheet, last, in danger text; the confirm is a bottom sheet with the safe action on the left and the destructive one on the right, both 44px. Undo toasts sit above the floating button. On desktop, the confirm is a small dialog (no wider than 480px) and Escape is the same as Keep.

## Writing

- Name the action the same way through the flow: Move to trash, then "Moved to trash"; Delete for good, then "Story deleted for good"; Restore, then "Story restored" and "It is back in your library".
- "This cannot be undone." is a plain sentence, last, and only when it is true.
- Say what stays: comments, the directory, other projects, the copy elsewhere.

## Accessibility

- A confirm is `role="alertdialog"` with its message linked by `aria-describedby`; focus starts on the safe button and returns to the trigger.
- The Undo toast is in a polite live region and its button is reachable by keyboard before it dismisses; the timer pauses on focus.
- Danger is shown in words and in the button label, not by colour alone.

**Do:** "Cover removed." with **Undo**, and nothing else.

**Don't:** "Are you sure you want to remove the cover?" with **Yes** and **No**.

**Do:** "Delete this story for good?" ""Blank Pages" and everything in it will be deleted from this device and the cloud. This cannot be undone." **Keep** / **Delete for good**

**Don't:** "Confirm action" "This action is irreversible." **Cancel** / **Yes, do it**, under a pulsing red shield.

## Demo

```html
<div class="kw-menu" role="menu" aria-label="Blank Pages" style="width:260px"><button class="kw-menu-item" role="menuitem" type="button">Project home</button><button class="kw-menu-item" role="menuitem" type="button">Share</button><button class="kw-menu-item" role="menuitem" type="button">Edit project</button><button class="kw-menu-item" role="menuitem" type="button">Export project</button><div class="kw-menu-sep" role="separator"></div><button class="kw-menu-item" role="menuitem" type="button" style="color:var(--k-danger)">Move to trash</button></div>
<div class="kw-toast kw-toast--info" role="status"><span>Moved to trash.</span><button class="kw-text-button" type="button">Undo</button></div>
<div class="kw-dialog" role="alertdialog" aria-labelledby="dd-demo-t" style="width:100%"><h2 id="dd-demo-t">Remove Dev?</h2><p style="margin:0;color:var(--k-text-2)">They lose access straight away and "Blank Pages" leaves their library. Their comments stay. You can add them again later.</p><div class="kw-dialog__actions"><button class="kw-button kw-button--quiet" type="button">Cancel</button><button class="kw-button kw-button--danger" type="button">Remove access</button></div></div>
```

## Related

[Dialog](https://kwark.space/designSystem/components/dialog.md), [Toast](https://kwark.space/designSystem/components/toast.md), [Menu](https://kwark.space/designSystem/components/menu.md), [Errors](https://kwark.space/designSystem/patterns/errors.md), [Sharing and roles](https://kwark.space/designSystem/patterns/sharing-and-roles.md), [Saving and sync](https://kwark.space/designSystem/patterns/saving-and-sync.md).

## AI readiness test

**Task:** Add "Delete shot" to Shots & Boards.

**Give the agent:** This page, Decision 0017, Decision 0020, Toast.

**Constraint:** Prefer the gentlest safe form.

**A reliable answer:**
- Deletes at once with "Shot deleted." and Undo, no dialog, because it is reversible
- The item is last in the shot's menu after a separator, in danger text
- Boards drawn for the shot are kept with the undo
- Issued call sheet revisions are not changed
- No "Are you sure?"
