Skip to content

Hide title generation until content exists#479

Open
dhrupo wants to merge 1 commit intoWordPress:developfrom
dhrupo:fix/391-hide-title-generation-without-content
Open

Hide title generation until content exists#479
dhrupo wants to merge 1 commit intoWordPress:developfrom
dhrupo:fix/391-hide-title-generation-without-content

Conversation

@dhrupo
Copy link
Copy Markdown

@dhrupo dhrupo commented Apr 27, 2026

What?

Closes #391

Hides the Title Generation control until the post has body content, and adds an e2e regression test for that empty-state behavior.

Why?

The current UI shows the title generation toolbar even when there is no content to generate from. That creates a confusing empty-state flow and matches the behavior reported in #391.

How?

The title toolbar now reads live editor state with useSelect and returns null when the edited post content is empty. The existing Generate/Regenerate labeling stays the same once content exists. An e2e test was added to verify the toolbar stays hidden for a blank post and appears after content is added.

Use of AI Tools

AI assistance: Yes
Tool(s): Codex
Model(s): GPT-5
Used for: Drafting the implementation and regression test; final changes were reviewed and edited before submission.

Testing Instructions

  1. Enable the Title Generation experiment.
  2. Create a new post with no title and no body content.
  3. Focus the title field and confirm the Title Generation control is not shown.
  4. Add body content to the post.
  5. Focus the title field again and confirm the control appears with the Generate label.
  6. For a post that already has a title and body content, confirm the control still appears with the Regenerate label.

Ran locally:

  • npm run typecheck
  • npm run lint:js -- src/experiments/title-generation/components/TitleToolbar.tsx tests/e2e/specs/experiments/title-generation.spec.js

Changelog Entry

Fixed - Hide the Title Generation control until a post has content to generate from.

Open WordPress Playground Preview

@github-actions
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: dhrupo <dhrupo@git.wordpress.org>
Co-authored-by: jeffpaul <jeffpaul@git.wordpress.org>
Co-authored-by: hemant7405 <hdkothari81@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 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.06%. Comparing base (a04709f) to head (ab80b8f).

Additional details and impacted files
@@            Coverage Diff             @@
##             develop     #479   +/-   ##
==========================================
  Coverage      69.06%   69.06%           
  Complexity       957      957           
==========================================
  Files             60       60           
  Lines           4512     4512           
==========================================
  Hits            3116     3116           
  Misses          1396     1396           
Flag Coverage Δ
unit 69.06% <ø> (ø)

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.

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.

Regenerate option is being shown even though there’s no content yet.

1 participant