Skip to content

Switch to using a Button component instead of ToolbarButton#375

Merged
dkotter merged 3 commits intoWordPress:developfrom
dkotter:fix/title-generation-button
Apr 9, 2026
Merged

Switch to using a Button component instead of ToolbarButton#375
dkotter merged 3 commits intoWordPress:developfrom
dkotter:fix/title-generation-button

Conversation

@dkotter
Copy link
Copy Markdown
Collaborator

@dkotter dkotter commented Apr 6, 2026

What?

Closes #368

Switch to using a Button component instead of a ToolbarButton component when in normal editing mode (non-template mode)

Why?

In normal editing mode, the title input isn't an actual block and thus doesn't support the normal block toolbar. We more or less "fake" that to inject our generate button when Title Generation is turned on. This leads to some weirdness though where the loading state and the active state would both show.

To fix, we now load a normal Button component and only load the ToolbarButton component when in template editing mode (where the title input is a block). Note this does change the design a bit (see screenshots below).

How?

  • When in "standalone" mode, use a Button component instead of a ToolbarButton component
  • When we inject our component, load it in "standalone" mode

Use of AI Tools

Use Cursor running GPT-5.3 Codex to investigate options beyond just overriding core CSS. Final testing and adjustments done by me

Testing Instructions

  1. Checkout this PR and run npm i && npm run build
  2. Turn on Title Generation
  3. Edit a post and click into the title input
  4. Ensure the Re-generate button shows
  5. Click it and ensure it works
  6. Switch into template editing mode
  7. Click into the title input and ensure a new Re-generate button shows
  8. Click it and ensure it works

Screenshots

Before After
ToolbarButton component Button component
Open WordPress Playground Preview

@dkotter dkotter added this to the 0.7.0 milestone Apr 6, 2026
@dkotter dkotter self-assigned this Apr 6, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 6, 2026

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.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @nurmhm.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

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

Unlinked contributors: nurmhm.

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

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

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.81%. Comparing base (aa6409b) to head (8e456de).
⚠️ Report is 126 commits behind head on develop.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop     #375   +/-   ##
==========================================
  Coverage      63.81%   63.81%           
  Complexity       684      684           
==========================================
  Files             49       49           
  Lines           3529     3529           
==========================================
  Hits            2252     2252           
  Misses          1277     1277           
Flag Coverage Δ
unit 63.81% <ø> (ø)

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

☔ View full report in Codecov by Sentry.
📢 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.

@jeffpaul jeffpaul self-requested a review April 7, 2026 13:34
Copy link
Copy Markdown
Member

@jeffpaul jeffpaul left a comment

Choose a reason for hiding this comment

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

Looks good, but let's hold on merging until we determine whether we need to revert #340 or not ahead of the 0.7.0 release.

@jeffpaul jeffpaul mentioned this pull request Apr 8, 2026
31 tasks
@dkotter dkotter mentioned this pull request Apr 9, 2026
6 tasks
@jeffpaul
Copy link
Copy Markdown
Member

jeffpaul commented Apr 9, 2026

@dkotter I think this one's good to merge for 0.7.0?

@dkotter dkotter merged commit 86b224d into WordPress:develop Apr 9, 2026
17 checks passed
@dkotter dkotter deleted the fix/title-generation-button branch April 9, 2026 16:59
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.

UX Issue: Double border on "Re-generate" button after generating header content

2 participants