Skip to content

Update/add placeholder for title block in post editor - #81944

Open
n8finch wants to merge 3 commits into
WordPress:trunkfrom
n8finch:update/add-placeholder-for-title-block-in-post-editor
Open

n8finch wants to merge 3 commits into
WordPress:trunkfrom
n8finch:update/add-placeholder-for-title-block-in-post-editor

Conversation

@n8finch

@n8finch n8finch commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

What?

Closes #81941

Why?

As noted in the linked issue, the placeholder attribute for the title block is not working as expected in the Post Editor, while it works in the Site Editor as expected. See testing instructions and images in the issue.

How?

This PR adds checks for the placeholder attribute and applies it if it exists.

Testing Instructions

Either in the WP Playground with this PR, or locally, checkout this branch, build and do the following:

  1. Open the Post Editor by creating a new Post or Page
  2. Make sure the Title block is on the page (it should say "(no title)")
  3. In the block's attributes (via Code Editor or block JSON), set e.g., "placeholder": "Add a post title", e.g.: <!-- wp:post-title {"placeholder": "Add a post title", "level":1,"style":{"typography":{"textAlign":"center"}}} /-->
  4. Switch back to the visual editor
  5. Expect the Post Title block to display "Add a post title" instead of the default "(no title)", image of expected output:
image

Testing Instructions for Keyboard

Repeat the testing instructions from above, using the Code Editor and Visual Editor toggle shortcuts, pasting in the example code: <!-- wp:post-title {"placeholder": "Add a post title", "level":1,"style":{"typography":{"textAlign":"center"}}} /-->

Before After
image image

Test suite added

Tests were added for this block in the /test/edit.js file.

To run these tests locally, run npm run test:unit -- packages/block-library/src/post-title/test/edit.js

What the tests cover:

  1. When a custom placeholder attribute set
  2. When no placeholder is set falls back to the default (no title)
  3. The same two cases for when the title is linked

All four test pass:

image

Use of AI Tools

Well I edited the code on my own the test suite that is added for this was generated with AI, specifically using Claude Opus 4.8.

@github-actions github-actions Bot added the [Package] Block library /packages/block-library label Aug 21, 2026
@github-actions

github-actions Bot commented Aug 21, 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: n8finch <n8finch@git.wordpress.org>
Co-authored-by: aduth <aduth@git.wordpress.org>

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

@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Block] Post Title Affects the Post Title Block labels Aug 24, 2026
@aduth

aduth commented Aug 26, 2026

Copy link
Copy Markdown
Member

Hey 👋 I wanted to give you a heads-up since this pull request adds new files containing JSX.

#80123 enables an ESLint rule that requires that files containing JSX must use the .tsx file extension. This is in line with coding guidelines expecting new code to be written as TypeScript.

What you'll need to do: You'll need to rename any new files containing JSX to use the .tsx file extension. This may also require you to address type errors that were not previously caught due to the use of the .js file extension.

This comment is automated, based on pull requests with recent activity that contain affected .js or .jsx files. But if you have any questions or if I can help with the migration in any way, please let me know and I'll do my best to help!

@n8finch
n8finch force-pushed the update/add-placeholder-for-title-block-in-post-editor branch from d1bae44 to 65dc0df Compare August 27, 2026 21:18
@n8finch

n8finch commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

Hey 👋 I wanted to give you a heads-up since this pull request adds new files containing JSX.

#80123 enables an ESLint rule that requires that files containing JSX must use the .tsx file extension. This is in line with coding guidelines expecting new code to be written as TypeScript.

What you'll need to do: You'll need to rename any new files containing JSX to use the .tsx file extension. This may also require you to address type errors that were not previously caught due to the use of the .js file extension.

This comment is automated, based on pull requests with recent activity that contain affected .js or .jsx files. But if you have any questions or if I can help with the migration in any way, please let me know and I'll do my best to help!

Just wanted to note that I've got this implemented.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Post Title Affects the Post Title Block [Package] Block library /packages/block-library [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Title block placeholder text does not appear in Post Editor screen, only Site Editor

3 participants