Skip to content

Excerpt Generation: Move the generate button into its own document sidebar panel - #1129

Closed
ntsekouras wants to merge 2 commits into
WordPress:developfrom
ntsekouras:update-generate-excerpt
Closed

ntsekouras wants to merge 2 commits into
WordPress:developfrom
ntsekouras:update-generate-excerpt

Conversation

@ntsekouras

@ntsekouras ntsekouras commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

What?

See WordPress/gutenberg#76076

Replaces the two buttons the Excerpt Generation experiment injected into core's excerpt UI with a single "Excerpt generation" panel in the document sidebar, registered via PluginDocumentSettingPanel.

Why?

Gutenberg's DataForm-based inspector (see the linked issue) replaces the post summary and never renders the __experimentalPluginPostExcerpt slot, so the popover button would stop appearing there.

Independently of that, relying on a deprecated slot and injecting markup next to core's excerpt field by targeting class names was never a sound integration. PluginDocumentSettingPanel is the supported extension point and renders below the summary in both inspectors.

How?

  • One PluginDocumentSettingPanel replaces the inline button and the popover fill. It follows core's Excerpt panel preference, so it hides when that panel is disabled or removed.
  • After generating, the panel shows a success notice with the text, which retires once the excerpt is edited by hand. The hook now only writes the excerpt to the store.

Notes

The new design (showing the notices (warning/success) through ui package etc.. is a personal suggestion. This PR could use some design feedback.

Testing Instructions

  1. Enable the Excerpt Generation experiment and connect a provider.
  2. Create a post with under 250 characters of content. Open the document sidebar: the "Excerpt generation" panel below Summary shows the too-short warning with a disabled button.
  3. Add more content. The warning disappears and the button is enabled. Click "Generate excerpt".
  4. A success notice with the excerpt appears in the panel, the button reads "Regenerate excerpt", and the Summary's excerpt row shows the same text.
  5. Edit the excerpt in the popover: the success notice disappears. Regenerate: it comes back.
  6. Preferences → Panels: turn off "Excerpt". The "Excerpt generation" panel disappears too.
  7. With the Gutenberg plugin and the "Editor Inspector: Use DataForm" experiment enabled, repeat steps 2 to 4. The panel renders below the DataForm summary and the Excerpt field updates.

Screenshots or screencast

Before and after, same flow:

excerpt-generation-before-after.mp4

Same flow with the DataForm inspector experiment:

excerpt-generation-dataform-inspector.mp4

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Fable 5.1
Used for: Implementation, e2e tests, docs and changelog drafts; reviewed, directed and edited by me.

Open WordPress Playground Preview

@ntsekouras
ntsekouras requested a review from a team October 6, 2026 16:05
@ntsekouras
ntsekouras requested a review from jeffpaul as a code owner October 6, 2026 16:05
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

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: ntsekouras <ntsekouras@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>

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

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
.fill( '' );
// Ensure the generated excerpt was written to the post. Checked through
// the store so the test does not depend on either inspector's excerpt UI.
expect(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

E2E checks go through the editor store rather than either inspector's excerpt UI.

@codecov

codecov Bot commented Oct 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.62%. Comparing base (e120e2c) to head (9cdc2a3).

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #1129   +/-   ##
==========================================
  Coverage      81.62%   81.62%           
  Complexity      3088     3088           
==========================================
  Files            129      129           
  Lines          12300    12300           
==========================================
  Hits           10040    10040           
  Misses          2260     2260           
Flag Coverage Δ
unit 81.62% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dkotter

dkotter commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

@ntsekouras I haven't looked at the code yet but in reading the PR description and looking at the screen shares, just want to make sure I understand correctly.

The new DataForm-based inspector will no longer fire the __experimentalPluginPostExcerpt slot, correct? So instead, we're registering a duplicate Excerpt panel in this PR? Not sure I love the idea of there now being two different places where an excerpt can be set, worried about the confusion that will bring.

Are these new DataForm changes coming in WordPress 7.2? Just wanting to understand the priority of making this change, if this is just to support those that may be testing out this new experience in Gutenberg or if we know for sure this will ship in 7.2 and needs addressed prior to that release. Thanks!

@ntsekouras

Copy link
Copy Markdown
Contributor Author

The new DataForm-based inspector will no longer fire the __experimentalPluginPostExcerpt slot, correct? So instead, we're registering a duplicate Excerpt panel in this PR? Not sure I love the idea of there now being two different places where an excerpt can be set, worried about the confusion that will bring.

Yes, that's the idea, and PluginDocumentSettingPanel is the way other plugins do similar things. __experimentalPluginPostExcerpt slot is also deprecated since 6.6.

For 7.2 we also aim to land the fields API, so an alternative would be to unregister the excerpt field and ai plugin to register it's own. Even with the fields API though in 7.2, the plugin should still support older WP versions for a bit (depends on the number of WP supported versions) and the suggestion in this PR works for both.

Are these new DataForm changes coming in WordPress 7.2?

They will be part of 7.2. Of course if face issues during beta, there is always the possibility to revert.

@dkotter

dkotter commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

@ntsekouras Thanks for the details.

@jeffpaul Curious for your thoughts here? This PR changes how excerpt generation is triggered, moving it into it's own sidebar panel. Sounds like we don't have many options here to support WordPress 7.2 but still want to get your eyes on this change.

@ntsekouras In testing, one thing I'd suggest is right now the excerpt is generated in the new panel, it's applied in the excerpt section and also shown in the custom panel but there's no way to edit the excerpt in this new panel. I'd suggest one of two approaches here:

  1. In this new panel, render the excerpt in a textarea so a user can easily edit it after generation in the same location, instead of making them go to the excerpt section
  2. Maybe even better, we can match the experience we use for Meta Description, which opens a modal during generation that has a textarea and the generated description shows there. A user can then edit the description and then apply it. If we follow the same approach here, that keeps things consistent and gives the user an easy approach to edit and also approve before the excerpt is automatically applied

@ntsekouras

Copy link
Copy Markdown
Contributor Author

In this new panel, render the excerpt in a textarea so a user can easily edit it after generation in the same location, instead of making them go to the excerpt section

We could do that, but my rationale was to avoid having two textareas for the same field. IMO this could create more noise and even confusion, especially if users/plugins have removed some fields from the Inspector and the two textareas are visible together. It feels like the functionality here is about generating and not simply editing.

Maybe even better, we can match the experience we use for Meta Description, which opens a modal during generation that has a textarea and the generated description shows there. A user can then edit the description and then apply it. If we follow the same approach here, that keeps things consistent and gives the user an easy approach to edit and also approve before the excerpt is automatically applied

The difference with Meta Description is that there is no core field/panel for that and my above rationale for two controls for the same field isn't possible. The modal approach though you suggest might be a middle-of-the-road one and I can try this one out.

@ntsekouras

Copy link
Copy Markdown
Contributor Author

@dkotter I opened an alternative PR with your suggestion to match Meta Description. I think it looks way better than this approach.

@dkotter

dkotter commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Going to close this out in favor of #1139 but we can re-open if that decision changes

@dkotter dkotter closed this Oct 9, 2026
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.

2 participants