Skip to content

feat(content): ask before Move to trash in the small dialog WordPress uses - #516

Merged
SirLouen merged 4 commits into
mainfrom
feat/514
Oct 19, 2026
Merged

SirLouen merged 4 commits into
mainfrom
feat/514

Conversation

@SirLouen

@SirLouen SirLouen commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Closes #514

What

The editor's Move to trash now asks the way the WordPress post editor asks.

  • It opens the shared confirm dialog at its small size, 400 pixels wide, with no title. On a phone it is a sheet at the bottom of the screen.
  • It asks WordPress's question: Are you sure you want to move "post name" to the trash? A post with no title is named "(no title)".
  • The buttons are Cancel and Move to trash. Cancel has the focus when it opens, and closing it puts the focus back on the button.
  • When the server refuses, the reason shows above the buttons and the dialog stays open.
  • The button sits under the excerpt, 16 pixels below it, and above the item's fields, where WordPress puts it before its other panels.
  • Spanish and French get the new question as drafts. The old title and description are gone.

Why

The old confirm was a titled dialog with its own description, unlike the WordPress editor's small confirm with one question.

Testing Instructions

  1. Open a post in the editor at 1280 pixels wide. Under Excerpt, Move to trash fills the sidebar width, and any fields of the type come below it.
  2. Click it. A 400 pixel dialog with no header asks Are you sure you want to move "the post's name" to the trash? Cancel has the focus.
  3. Press Escape. The dialog closes and the focus is back on Move to trash.
  4. Click it again and choose Move to trash. The editor goes back to the list and a message says the post moved to the trash.
  5. Set the window to 390 pixels wide, open another post and click Move to trash. The question opens as a sheet at the bottom of the screen.
  6. Clear a post's title and click Move to trash. The question names "(no title)".

Summary by CodeRabbit

  • User Interface
    • The Move to trash button now appears below the excerpt and above the post’s fields.
    • Trash confirmation uses a compact dialog asking whether to move the specific post to the trash, without a heading or restoration notice.
    • If moving a post to the trash fails, the error appears above the dialog buttons, and the dialog stays open. Reopening the dialog clears any previous error.
    • On phones, the confirmation dialog spans the screen width and aligns with the bottom edge.

@codescene-access codescene-access Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gates Passed
4 Quality Gates Passed

See analysis details in CodeScene

Quality Gate Profile: Clean Code Collective
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: gopherium/gophenberg/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 62c81708-27a0-4e8d-9bc4-881952a848bd
📥 Commits

Reviewing files that changed from the base of the PR and between 2c754c3 and 0be8e83.

📒 Files selected for processing: 15
  • docs/src/content/docs/guides/fields.md
  • docs/src/content/docs/guides/posts.md
  • frontend/src/content/DocumentPanels.tsx
  • frontend/src/content/TrashPost.tsx
  • frontend/src/languages/es-ES.json
  • frontend/src/languages/fr-FR.json
  • frontend/src/test/editor-narrow.test.tsx
  • frontend/src/test/editor-trash.test.tsx
  • internal/i18n/catalogs/es-ES.json
  • internal/i18n/catalogs/fr-FR.json
  • languages/es-ES.po
  • languages/fr-FR.po
  • languages/gophenberg.pot
  • test/e2e/tests/editor-phone.spec.ts
  • test/e2e/tests/editor.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

📝 Walkthrough

The editor now places Move to trash before declared fields and uses a small confirmation dialog with a question that names the post. The dialog displays refusal errors above its buttons. Documentation, translations, and tests reflect these changes.

Changes: Trash confirmation

Layer / File(s) Summary
Sidebar placement and confirmation dialog
frontend/src/content/DocumentPanels.tsx, frontend/src/content/TrashPost.tsx, docs/src/content/docs/guides/fields.md, docs/src/content/docs/guides/posts.md, languages/*.po, languages/gophenberg.pot
The trash button appears before declared fields. Its confirmation uses a small dialog with a question that includes the post title. When trashing fails, the handler returns the error message. Documentation and translations describe the updated prompt and placement.
Dialog and layout validation
frontend/src/test/editor-*.test.tsx, test/e2e/tests/editor*.spec.ts
Component and end-to-end tests check the dialog content, role, focus and dismissal, refusal errors, button placement, and phone-screen layout.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Merge Risk: ⚪ Minimal · up to 0be8e

No identified issue blocks merging after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the main change: the Move to trash action now asks for confirmation in the small shared dialog used by WordPress.
Linked Issues check Passed Issue #514 requires the shared small confirmation dialog, the WordPress question, and WordPress-style button placement. TrashPost.tsx uses ConfirmDialog with size="small", the required question,…
Out of Scope Changes check Passed The changed source, tests, documentation, and Spanish and French catalog entries all support the linked trash-confirmation behavior, its sidebar placement, or its localization. No unrelated change is …
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 6 files. (5 skipped: 5 …
Full details: Linked Issues check

Explanation

Issue #514 requires the shared small confirmation dialog, the WordPress question, and WordPress-style button placement. TrashPost.tsx uses ConfirmDialog with size="small", the required question, and the (no title) fallback. DocumentPanels.tsx places TrashPost after the excerpt stack and before FieldsPanel. Tests cover the 400-pixel dialog, phone sheet, buttons, focus return, server refusal, and dialog persistence.

Full details: Out of Scope Changes check

Explanation

The changed source, tests, documentation, and Spanish and French catalog entries all support the linked trash-confirmation behavior, its sidebar placement, or its localization. No unrelated change is demonstrated by the reviewed summary or focused diff.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 6 files. (5 skipped: 5 unsupported.)

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@gitar-bot

gitar-bot Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Replacing the trash alert with shared ConfirmDialog changes destructive-action handling; its implementation is outside this diff, so whether confirmation reliably gates post removal is uncertain.

Adds a WordPress-style confirm before Move to trash: a 400px dialog with no title, a sheet on phones, Cancel focused by default, and server errors shown above the buttons. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@greptile-apps

greptile-apps Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] No blocking issues were established; the scoped checks support merging this change.

Summary

The editor now uses the shared small confirmation dialog before moving a post to the trash.

  • The editor asks before moving a post to the trash in a small, title-free dialog.

All 53 focused editor tests passed. Browser checks exercised initial Cancel focus, cancellation without deleting the post, focus restoration, server-error display, and successful retry with navigation and a confirmation message. Desktop and phone measurements matched the requested dialog presentation.

No actionable issues were established in the scoped checks.

Reviews (1) · Last reviewed commit: "docs(guides): describe the editor's tras..." · Reviewed by Greptile

@SirLouen
SirLouen merged commit 58b460f into main Oct 19, 2026
21 checks passed
@SirLouen
SirLouen deleted the feat/514 branch October 19, 2026 12:39
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.

Ask before Move to trash the way the WordPress editor does

1 participant