Skip to content

fix(theme): ask before deleting a custom theme in the app's own dialog - #32502

Merged
bolichen97 merged 1 commit into
mainfrom
fix/theme-delete-confirm-30400
Nov 7, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/theme-delete-confirm-30400

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Deleting a custom theme asks in the app's own dialog, and the question names the theme.

Settings › Display › Theme: pressing Delete on a custom theme (in the theme list, or in the editor) raised the browser's native confirm("Delete this custom theme?"). It does not say which theme, and it looks nothing like the rest of the dashboard. Deleting a chat folder already asks in an in-app dialog that names the folder.

Why it matters

Anyone who deletes a custom theme gets a bare browser box that does not say what goes away. In the desktop app a native confirm() is an OS dialog that freezes the renderer, and the window can stop taking input after it closes (see lib/appConfirm.ts).

Not a goal

  • The other native confirm() calls in the dashboard. Open PRs already move them (listed under Sibling sweep).
  • Any change to what a delete does. The theme store's deleteCustomTheme is untouched.

What changed (motivation → approach → change)

The theme editor's handleDelete called the browser's confirm(). It now asks through askAppConfirm(), the app-wide in-app dialog that the folder delete uses.

Before After
Dialog browser confirm() in-app dialog, danger style
Text "Delete this custom theme?" "Delete “🌊 Ocean”? If it is your current theme, the default theme is used instead."
Confirm button OK Delete theme

The name is the theme's label as the theme list shows it (emoji plus name). A slug with no list entry is shown as the slug. Both delete buttons (the list row and the editor) go through the same handleDelete.

The editor is itself a Modal, and the confirmation opens on top of it. Both listen for Escape, so an Escape that cancels the delete closed the editor too. useThemeEditor now reports confirmingDelete while the ask is open, and the editor's Modal in DisplayPanel.tsx adds it to guardAccidentalDismiss. Escape now closes only the confirmation.

The two new strings are in all twelve catalogs, with each language's operand quotes. The old delete_this_custom_theme key is removed. The new confirm key is pinned in destructiveConfirm.test.ts, so its quotes stay in every language. en-XA.json is regenerated.

Backwards compatibility

Compatible: the delete still runs only after the user says yes; only the dialog changes.

Reader: website/src/components/themeEditor.tsx:handleDelete -- app -- the only reader of components.themeEditor.delete_this_custom_theme, replaced here by the two new keys (git grep delete_this_custom_theme origin/main -- website/src ':!website/src/i18n/locales' finds no other)

Tests

website/src/test/ThemeEditorCoverage.test.tsx:

  • asks in the app, never the browser, and names the theme being deleted: the browser's confirm is never called, the in-app ask names “🌊 Ocean”, its button says Delete theme, and the delete runs. It fails on main (window.confirm called once).
  • names a theme missing from the list by its slug.
  • reports the confirmation as open until it is answered: confirmingDelete is true while the ask waits and false after it.
  • keeps the editor dialog open when Escape cancels the delete confirmation: the real editor in a real Modal with the real AppConfirmHost; Escape pressed from the focused confirmation leaves the editor open and deletes nothing.
  • The existing decline, no-target, error and editor-button tests now answer through the in-app ask instead of a window.confirm spy.

Proof: not provable -- frontend test (prove.py runs Python only)

Each new test was run against the code without its fix and failed: the native-confirm test on main's themeEditor.tsx (window.confirm called once), the two Escape tests without confirmingDelete (the editor closed). All pass with the fix, and the file passed three shuffled runs.

Manual verification

In an isolated dev instance (headless Chromium), Settings › Display › Theme: created a theme named Everything, pressed Delete in the list and Delete Theme in the editor. Both show the in-app dialog with the theme's name, and no native dialog fired. Pressing Escape on the editor's confirmation closed the dialog and kept the editor open (before the guard, both closed). The headless browser has no emoji font, so the 🎨 in the name shows as a blank in the screenshots.

Screenshots / video

Delete from the theme list:

Delete theme dialog from the theme list

Delete from the theme editor, above the editor dialog:

Delete theme dialog over the editor

After Escape, only the confirmation is gone:

Editor still open after Escape

Related Issues

Fixes #30400

Sibling sweep

Swept: git grep -nE "(window.)?confirm(" -- website/src ':!.test.'
Sibling: website/src/pages/ArtifactsPage.tsx -- tracked in #30515
Sibling: website/src/pages/ArtifactDetailPage.tsx -- tracked in #30515
Sibling: website/src/apps/meetings/MeetingsPage.tsx -- tracked in #30517
Sibling: website/src/apps/papyrus/ProjectList.tsx -- tracked in #30517
Sibling: website/src/apps/design-tweak/DesignTweakPage.tsx -- tracked in #30517
Sibling: website/src/apps/auto-improvement/AutoImprovementPage.tsx -- tracked in #30517
Sibling: website/src/apps/papyrus/PapyrusPage.tsx -- tracked in #30752

Pattern harvest

Rule candidate: semgrep
Pattern: a dashboard source file that calls the browser's confirm() or window.confirm() instead of useConfirm() / askAppConfirm().

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 7, 2026 18:18
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of ba39a3ee1ce14d0a4ef71075062e833bf6b45b5c — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the fix reuses the existing app-wide askAppConfirm seam, the Escape double-close is handled through the editor Modal's existing dismissal guard, and the screenshots cover both entry points.

[DESIGN-REVIEWED] ba39a3e

Description read

[DESCRIPTION-READ] be4e06f21f4e36b49981156c1b0b833c099a7b36eb0046aa5039c3eedb061d2b

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of ba39a3ee1ce14d0a4ef71075062e833bf6b45b5c — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks. The blind reader read the dialog, its message and the "Delete theme" confirm button correctly, and would dare use each one. All three are in the screenshots.

Notes

  • The editor's button says "🗑 Delete Theme" but the dialog's button says "Delete theme". The blind reader noticed and wasn't sure they were the same action. Use one capitalisation on both.

[UX-REVIEWED] ba39a3e

Description read

[DESCRIPTION-READ] 35048ad29e9caa4f545bdd54b315ce6270fcf072657aa0238ac74bf17421cf4c

That sha256 names everything this verdict read: the PR description, plus the 6 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of ba39a3ee1ce14d0a4ef71075062e833bf6b45b5c — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. The native confirm() is replaced by the existing askAppConfirm() (the fix for #30400), and the new dialog names the theme. One note: the Escape guard patches a Modal stacking gap at a single call site.

Notes

  • Item 5 — symptom-level: both Modals listen for Escape on window, and the editor's listener was added first, so it runs before the confirmation can preventDefault (Modal.tsx comment: "Overlays that render above this modal call preventDefault on their own Escape handling"). The confirmingDelete flag works around that from the outside, for this one editor. Subtraction: remove confirmingDelete from useThemeEditor's return value and from DisplayPanel.tsx's guardAccidentalDismiss once the stacked confirmation consumes its own Escape.

What this change ships

Inventory (7 items) — 6 justified

Intent: when someone deletes a custom theme, they get the app's own confirmation dialog, and it says which theme will be deleted. FIX.

  1. Deleting a theme now asks in an in-app danger dialog instead of the browser's confirm box — justified
  2. The question names the theme ("Delete “🌊 Ocean”?"), or shows the slug if the theme is not in the list — justified
  3. The confirm button reads "Delete theme" instead of OK — justified
  4. The body adds that the default theme is used if the deleted one was current — justified
  5. Escape on the delete confirmation no longer closes the editor behind it — symptom-level: guard at the call site, the cause is in Modal
  6. The old catalog key delete_this_custom_theme is removed from all locales — justified
  7. The new confirm key is pinned in the quoted-operand list — justified

[FIRST-PRINCIPLES-REVIEWED] ba39a3e

Description read

[DESCRIPTION-READ] 8ded2955f07cc408f5e79d605d73df44c094531009f5a5f6926e60325fef8587

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed ba39a3ee1ce14d0a4ef71075062e833bf6b45b5c — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] ba39a3e

Verdict parsed from the review's SHA-scoped output markers for commit ba39a3ee1ce14d0a4ef71075062e833bf6b45b5c.

False positive or not applicable? A repository writer can comment:
/ai-review override fable ba39a3ee1ce14d0a4ef71075062e833bf6b45b5c false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of ba39a3ee1ce14d0a4ef71075062e833bf6b45b5c and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] ba39a3e

False positive or not applicable? A repository writer can comment:
/ai-review override gpt ba39a3ee1ce14d0a4ef71075062e833bf6b45b5c false-positive: <reason, 20 to 500 characters>

@bolichen97
bolichen97 enabled auto-merge (squash) November 7, 2026 18:44
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 7, 2026

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tier 1 auto-approve: fix (17 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: replaces the browser confirm() for deleting a custom theme with the in-app dialog that names the theme, with locale strings and tests.

@bolichen97
bolichen97 merged commit 9aeb2eb into main Nov 7, 2026
98 checks passed
@bolichen97
bolichen97 deleted the fix/theme-delete-confirm-30400 branch November 7, 2026 19:07
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 7, 2026
buluoray pushed a commit that referenced this pull request Nov 8, 2026
#32502)

Co-authored-by: w <w@k.local>
(cherry picked from commit 9aeb2eb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deleting a custom theme uses the browser's native confirm, without the theme's name

2 participants