Skip to content

feat: confirm destructive actions with the Dialog pattern instead of the browser's confirm() #756

Closed

Description

@gkhngyk

Problem / motivation

Destructive actions are confirmed three different ways depending on where you happen to be.

A Dialog — audit/[id]/page.tsx wraps the delete button in a Dialog with a title, a description, Cancel, and a destructive confirm button.

A typed confirmation — deleting a brand asks you to type the brand name (settings.deleteConfirmPlaceholder in web/messages/en.json).

The browser's own confirm() — four places:

File Action
agent/page.tsx deleteConversation delete a conversation
reports/page.tsx handleDelete delete a report
settings/api-keys-section.tsx handleRevoke revoke an API key
settings/agent-section.tsx handleClear remove the org's Anthropic key

confirm() is the browser's own modal. It ignores the theme, cannot be styled, cannot mark the destructive choice as destructive, renders as an OS alert on mobile, and blocks the whole tab while it is open. Two of the four also have their prompt text hardcoded in English while the other two use t().

The last two are the ones that sting: revoking an API key breaks every client using it, and clearing the org key cuts the whole team off from the agent. Those deserve better than a grey system box.

Proposed solution

Move all four to the Dialog pattern the audit page already uses. That page is the reference — copy its shape rather than inventing a new one:

  • DialogTitle naming the action, DialogDescription saying what it costs
  • DialogClose with variant="outline" to cancel
  • DialogClose with variant="destructive" to confirm

Notes

  • agent and reports delete a specific row from a list, so the dialog needs to know which one. A single dialog driven by a pendingId piece of state reads better than one dialog rendered per row — pick whichever you can make clean, but don't render N dialogs if the list can be long.
  • The existing t('deleteConfirm') strings already say the right thing; reuse them as the DialogDescription.
  • The two settings sections have their text inline. While you're there, move those strings into web/messages/en.json alongside the others.
  • Keep the disabled/pending state the handlers already manage (deletingId, clearing) so the confirm button can't be double-clicked.

Out of scope

Brand deletion's typed confirmation stays as it is. Typing the name is a deliberately higher bar for a deliberately bigger action.

Alternatives considered

Add an AlertDialog primitive. The usual shadcn split gives destructive confirmations their own component. There isn't one in web/src/components/ui/ today, and adding a primitive is a larger change than this needs — Dialog already does the job on the audit page.

Leave confirm() alone. It does technically confirm. But the app looks like an application everywhere else and like a 1998 browser here, and the two key-related actions are exactly where a user should be able to read carefully before clicking.

Related: #614 covers a delete that has no confirmation at all. Different problem, no overlap.

Activity

  1. added
    enhancement
    good first issue
    help wanted
    on Aug 20, 2026
  2. BharadwajKanneveti commented on Aug 20, 2026

    @BharadwajKanneveti
    Contributor

    @gkhngyk I will pick this issue

  3. gkhngyk commented on Aug 25, 2026

    @gkhngyk
    ContributorAuthor

    Assigned to you, @BharadwajKanneveti — thanks for picking it up. The audit page is the reference for the shape; ping here if anything in the issue is unclear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementgood first issuehelp wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions