Skip to content

Title Generation: Re-attach the title toolbar after switching to the Code editor and back - #1444

Open
SainathPoojary wants to merge 2 commits into
WordPress:developfrom
SainathPoojary:fix/title-toolbar-code-editor
Open

SainathPoojary wants to merge 2 commits into
WordPress:developfrom
SainathPoojary:fix/title-toolbar-code-editor

Conversation

@SainathPoojary

@SainathPoojary SainathPoojary commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

What?

Brings back the Title Generation toolbar after switching to the Code editor and back.

Why?

After you switch to the Code editor and back to the Visual editor, the "Generate" toolbar above the post title is gone until you reload the page. This is the same problem as #693, but with a different trigger.

How?

The toolbar code watches the editor page for changes so it can add the toolbar back. It watches only the first editor page. The Code editor removes that page, and the Visual editor creates a new one, so the code keeps watching a page that no longer exists.

This PR listens for the editor mode. When it changes back to Visual, the code watches the new page and adds the toolbar again. It uses the same subscribe pattern as block-container-label-generation/components/RenameModalWrapper.tsx.

It also adds an e2e test for this case.

Use of AI Tools

  • AI assistance: Yes
  • Tool(s): Claude Code
  • Model(s): Claude Opus 5.5
  • Used for: Claude Code helped with the code changes. Review and testing the changes was done by me

Testing Instructions

  1. Go to Settings → AI and turn on the Title Generation experiment.
  2. Go to Posts → Add New.
  3. Click the post title. The "Generate" toolbar shows above it.
  4. Click the Options menu (the three dots ⋮ at the top right of the editor) and choose Code editor.
  5. Click Exit code editor at the top of the Code editor to go back to the Visual editor.
  6. Click the post title again.
  7. The "Generate" toolbar shows. Before this PR, it does not show until you reload the page.

Screenshots or screencast

Before

Screen.Recording.2026-11-27.at.8.05.35.PM.mov

After

Screen.Recording.2026-11-27.at.8.04.01.PM.mov

Changelog Entry

Fixed - Title Generation toolbar not shown after switching to the Code editor and back.

Open WordPress Playground Preview

@codecov

codecov Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.59%. Comparing base (c4666bb) to head (1b034e0).

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #1444   +/-   ##
==========================================
  Coverage      85.59%   85.59%           
  Complexity      5091     5091           
==========================================
  Files            193      193           
  Lines          18425    18425           
==========================================
  Hits           15770    15770           
  Misses          2655     2655           
Flag Coverage Δ
unit 85.59% <ø> (ø)

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.

@SainathPoojary
SainathPoojary marked this pull request as ready for review November 27, 2026 18:45
@SainathPoojary
SainathPoojary requested a review from a team November 27, 2026 18:45
@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.

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: SainathPoojary <sainathpoojary@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 or WordPress.org 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.

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.

1 participant