Skip to content

Status field: Own the rule that leaves Trash out of the status options - #87552

Merged
oandregal merged 3 commits into
trunkfrom
update/status-field-hide-trash-option
Nov 27, 2026
Merged

oandregal merged 3 commits into
trunkfrom
update/status-field-hide-trash-option

Conversation

@oandregal

Copy link
Copy Markdown
Member

What?

Follow up to #87541. Related to #87547.

Moves the rule that keeps "Trash" out of the status options from the forms into the status field.

Why?

A post goes to the trash through the "Move to trash" action, not by editing its status. Every form that edits the status removed the trash element by hand: the quick edit modals of both site editors and the editor's inspector.

The field can't simply drop the element, because DataViews uses the same elements to label values: the Trash view's locked filter would read "Status" instead of "Status includes: Trash", and the status of a trashed post would lose its label.

How?

  • Status field (@wordpress/core-fields): adds an Edit, a RadioGroupControl of @wordpress/ui, that leaves trash out of the options. The trash element stays, so filters and views keep labelling it. Changes still go through the field's setValue, and isDisabled still applies. The server-side 'Edit' => 'radio' is removed, since the script part now provides the control.
  • Quick edit modals (packages/edit-site and routes/post-list) and the inspector (packages/editor): drop their own trash filters. In the site editor v1 modal nothing else changes the fields, so it uses them as they come.

Testing Instructions

  1. Open a page in the editor and click Status in the inspector: Draft, Scheduled, Pending Review, Private and Published are offered, not Trash. Picking one changes the status as before.
  2. Go to Pages in the site editor (v1 and the extensible site editor) and open quick edit, then bulk edit: the status options are the same, without Trash.
  3. Open the Trash view of Pages: the filter reads "Status includes: Trash", and trashed pages show the Trash status with its icon.
  4. As a user who can't publish (a contributor), open a draft: the status options are disabled.

Testing Instructions for Keyboard

  1. In the inspector, Tab to Status and press Enter: the options open, and the arrow keys move between them without reaching Trash.

Screenshots or screencast

The status options in the inspector look as they did before: five statuses and the password option.

Use of AI Tools

oandregal and others added 2 commits November 27, 2026 12:01
A post goes to the trash through the "Move to trash" action, not by
editing its status. The field keeps the `trash` element, which filters
and views need to label a trashed post, and its own `Edit` now leaves it
out of the radio options, so every form gets that without filtering the
elements itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The status field's control no longer offers the trash, so the quick edit
modals and the inspector don't need to filter it out of the elements.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oandregal oandregal added the [Type] Code Quality Issues or PRs that relate to code quality label Nov 27, 2026
Copilot AI balanced review requested due to automatic review settings November 27, 2026 11:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions github-actions Bot added [Package] Editor /packages/editor [Package] Edit Site /packages/edit-site [Package] Fields /packages/fields labels Nov 27, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground Preview in Storybook

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: oandregal <oandregal@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

📦 Bundle size

Size Change: +5.02 kB (+0.06%)

Total Size: 8.73 MB

📦 View Changed
Filename Size Change
build/modules/core-fields/post_type_supports.min.js 87.6 kB +5.1 kB (+6.19%) 🔍
build/scripts/edit-site/index.min.js 384 kB -31 B (-0.01%)
build/scripts/editor/index.min.js 575 kB -49 B (-0.01%)

53d0d6f Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric a0512fc trunk % Change
timeToFirstByte 45 ms +6.44% -4% 44.2 ms +6.56% -2.71% 1.81%
largestContentfulPaint 72 ms +5.56% -5.56% 72 ms +2.78% -5.56% 0%
lcpMinusTtfb 27.9 ms +4.48% -13.62% 24.85 ms +18.51% -6.84% 12.27%
wpBeforeTemplate 23.34 ms +9.68% -3.94% 23.03 ms +5.34% -1.35% 1.35%
wpTemplate 17.65 ms +3.74% -3.97% 17.27 ms +6.08% -3.01% 2.2%
wpTotal 41.61 ms +6.42% -3.99% 41.02 ms +5.1% -3.49% 1.44%
wpMemoryUsage 7.75 MB +0% -0% 7.72 MB +0% -0% 0.45%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric a0512fc trunk % Change
timeToFirstByte 36.75 ms +4.49% -4.08% 35.75 ms +5.73% -1.4% 2.8%
largestContentfulPaint 64 ms +9.38% -0% 64 ms +0% -0% 0%
lcpMinusTtfb 28.3 ms +8.83% -3.71% 28.4 ms +2.11% -4.23% -0.35%
wpBeforeTemplate 20.31 ms +5.76% -1.43% 19.78 ms +4.15% -0.66% 2.68%
wpTemplate 12.86 ms +8.24% -3.27% 12.75 ms +4.24% -3.69% 0.86%
wpTotal 34.22 ms +3.48% -4.53% 32.92 ms +4.28% -1.28% 3.95%
wpMemoryUsage 6.44 MB +0% -0% 6.41 MB +0% -0% 0.56%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric a0512fc trunk % Change
mediaProcessingJpeg 326.59 ms +1.68% -0.12% 327.43 ms +0.22% -1.65% -0.26%
mediaProcessingAvif 4858.81 ms +0.05% -0.64% 4882.21 ms +0.62% -0.16% -0.48%
mediaProcessingJpegToAvif 3382.5 ms +0.19% -0.1% 3402.83 ms +0.23% -0.39% -0.6%

media-upload

Metric a0512fc trunk % Change
jpegUploadProcessing 1464.57 ms +3.1% -1.97% 1460.33 ms +0.84% -0.45% 0.29%
pngUploadProcessing 237.58 ms +1.75% -3.78% 240.31 ms +8.09% -3.88% -1.14%
largeJpegUploadProcessing 1448.56 ms +0.49% -0.9% 1447.79 ms +0.62% -0.61% 0.05%
multipleImageUploadProcessing 1505.96 ms +1.63% -0.97% 1502.23 ms +3.12% -0.35% 0.25%

post-editor

Metric a0512fc trunk % Change
serverResponse 320.95 ms +7.8% -7.97% 321.09 ms +5.69% -6.15% -0.04%
firstPaint 318.67 ms +7.24% -4.66% 354.8 ms +8.8% -9.61% -10.18%
domContentLoaded 645.27 ms +2.76% -1.03% 669.11 ms +2.22% -1.43% -3.56%
loaded 646.11 ms +2.75% -1.04% 669.92 ms +2.23% -1.41% -3.55%
firstContentfulPaint 367.65 ms +3.81% -2.12% 383.02 ms +1.63% -1.1% -4.01%
firstBlock 1736.79 ms +0.49% -0.57% 1786.67 ms +1.16% -2.16% -2.79%
type 14.97 ms +6.61% -9.69% 15.7 ms +5.54% -7.58% -4.65%
typeWithoutInspector 15.01 ms +6.46% -10.66% 15.35 ms +8.21% -11.27% -2.21%
typeWithTopToolbar 19.51 ms +6.56% -7.74% 20.99 ms +2.19% -16.82% -7.05%
typeContainer 6.61 ms +8.62% -10.59% 6.97 ms +5.16% -16.07% -5.16%
focus 90.65 ms +4.94% -7.71% 86.26 ms +2.85% -4.82% 5.09%
firstFocus 217.8 ms +0% -0% 200.16 ms +0% -0% 8.81%
selectAll 303.48 ms +2.63% -0.85% 303.25 ms +1.91% -3.91% 0.08%
undo 24.1 ms +4.81% -5.52% 23.35 ms +7.67% -4.88% 3.21%
listViewOpen 29.72 ms +12.85% -2.79% 30.43 ms +1.31% -7.79% -2.33%
inserterOpen 32.81 ms +8.87% -5.33% 32.56 ms +8.57% -9.49% 0.77%
inserterHover 9.87 ms +14.39% -4.15% 9.37 ms +7.9% -5.87% 5.34%
inserterSearch 7.17 ms +5.44% -2.79% 7.03 ms +0.71% -3.7% 1.99%
loadPatterns 527.52 ms +4.39% -0.86% 503.21 ms +2.04% -4.61% 4.83%
wpTotal 312.29 ms +7.37% -8.2% 312.54 ms +5.77% -6.39% -0.08%
wpMemoryUsage 14.81 MB +0% -0% 14.76 MB +0% -0% 0.33%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric a0512fc trunk % Change
serverResponse 333.85 ms +1.21% -7.84% 311.17 ms +8.02% -0.87% 7.29%
firstPaint 342.64 ms +6.73% -2.87% 379.71 ms +2.31% -11.31% -9.76%
domContentLoaded 699.17 ms +2.91% -1.35% 688.13 ms +1.93% -0.56% 1.6%
loaded 699.94 ms +2.91% -1.34% 688.89 ms +1.94% -0.55% 1.6%
firstContentfulPaint 388.27 ms +1.85% -1.26% 387.54 ms +2.17% -0.59% 0.19%
firstBlock 2083.87 ms +0.29% -0.57% 2086.72 ms +1.48% -1.31% -0.14%
type 15.87 ms +4.66% -12.22% 14.86 ms +9.49% -4.98% 6.8%
navigate 96.97 ms +4.44% -1.43% 109.33 ms +2.83% -15.26% -11.31%
loadPatterns 1118.59 ms +5.75% -9.56% 1199.87 ms +5.18% -2.91% -6.77%
loadPages 926.4 ms +1.72% -2.15% 952.88 ms +3.96% -1.07% -2.78%
wpTotal 325.78 ms +1.19% -8.06% 303.02 ms +8.29% -0.84% 7.51%
wpMemoryUsage 12.84 MB +0% -0% 12.80 MB +0% -0% 0.28%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

53d0d6f Run

🏁 Flaky tests

Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

page-list submenu user interactions in /test/e2e/specs/editor/blocks/navigation-frontend-interactivity.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for getByRole('region', { name: 'Editor top bar' }).getByRole('button', { name: 'Save', exact: true })
    - locator resolved to <button type="button" aria-disabled="true" class="components-button editor-post-publish-button editor-post-publish-button__button is-primary is-compact">Save</button>
  - attempting click action
    2 × waiting for element to be visible, enabled and stable
      - element is not enabled
    - retrying click action
    - waiting 20ms
    2 × waiting for element to be visible, enabled and stable
      - element is not enabled
    - retrying click action
      - waiting 100ms
    16 × waiting for element to be visible, enabled and stable
       - element is not enabled
     - retrying click action
       - waiting 500ms

    at Editor.saveSiteEditorEntities (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/editor/site-editor.ts:39:22)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/navigation-frontend-interactivity.spec.js:706:4

53d0d6f Run

const { editEntityRecord, saveEditedEntityRecord } =
useDispatch( coreDataStore );

const _fields = usePostFields( { postType } );

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This was great to achieve.

return array(
'type' => 'text',
'label' => __( 'Status' ),
'Edit' => 'radio',

@oandregal oandregal Nov 27, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think there's potential to do this differently: instead of implementing a custom Edit, we could pass some meta info to the elements to control where each element is displayed. For example, something along the lines of visibility: [ 'filter', 'view' ] (to hide the element on edit) or just more directly visibility: cannot-edit. I went for the custom Edit to minimize API changes until more use cases emerge for this kind of thing.

@oandregal
oandregal merged commit 2468719 into trunk Nov 27, 2026
112 of 114 checks passed
@oandregal
oandregal deleted the update/status-field-hide-trash-option branch November 27, 2026 11:41
@github-actions github-actions Bot added this to the Gutenberg 24.6 milestone Nov 27, 2026
@oandregal oandregal changed the title Status field: Leave the trash out of the status options Status field: Own the rule that leaves Trash out of the status options Nov 27, 2026
Vedant-Gandhi pushed a commit to Vedant-Gandhi/gutenberg that referenced this pull request Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Edit Site /packages/edit-site [Package] Editor /packages/editor [Package] Fields /packages/fields [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants