Skip to content

Quote: Ensure paragraph placeholder appears after deleting nested blocks#77151

Open
dpmehta wants to merge 2 commits intoWordPress:trunkfrom
dpmehta:fix/quote-block-inner-blocks-deletion
Open

Quote: Ensure paragraph placeholder appears after deleting nested blocks#77151
dpmehta wants to merge 2 commits intoWordPress:trunkfrom
dpmehta:fix/quote-block-inner-blocks-deletion

Conversation

@dpmehta
Copy link
Copy Markdown
Contributor

@dpmehta dpmehta commented Apr 8, 2026

What?

Closes #59709

This PR updates the Quote block to conditionally show the default appender only when the block is empty, ensuring that deleting nested block correctly reverts the Quote block to its initial state with a paragraph placeholder.

Why?

Previously Quote block had its appender strictly disabled renderAppender: false. Because of this, when we delete the last inner-block (e.g list block) by pressing backspace, the block becomes completely empty. Since there was no appender available, the Gutenberg editor could not display prompt ( like a placeholder paragraph block ) which forces the editor selection logic to fall entirely out of the main editing area and into the only remaining interactable field that is citation text field.

How?

This PR updates code to evaluate whether the block is completely empty using useSelect to read innerBlocks.length:

  • We now fetch hasInnerBlocks.

  • Instead of strictly hardcoding renderAppender: false, it's now updated to renderAppender: hasInnerBlocks ? false : undefined.

  • Now, when the block has nested inner blocks, the appender stays hidden (maintaining previous behavior expectations). However, if you delete the nested block (i.e. the List), hasInnerBlocks becomes false, Gutenberg shows the undefined default block appender natively, and hitting Backspace safely turns that empty state into a default selected Paragraph context

Testing Instructions

  1. Open any demo or testing Post.
  2. Add Quote block into that Post.
  3. Add list blocks inside Quote block and add one item into list block.
  4. Now using backspace remove list item and list block.
  5. Observe now Quote block shows Placeholder and appender by which nested (Inner) block can be added.

Screenshots or screencast

Before

quote-block-inserter-before.mov

After

quote-block-inserter-after.mov
Before After
Screenshot 2026-04-08 at 6 58 18 PM Screenshot 2026-04-08 at 6 56 33 PM

Use of AI Tools

Used Gemini 3.1 Pro for code analysis and testing purpose and drafting PR text. All logic changes were manually reviewed and validated in a local environment.

@github-actions github-actions Bot added the [Package] Block library /packages/block-library label Apr 8, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 8, 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.

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: dpmehta <mehtadev@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org>

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

@github-actions github-actions Bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Apr 8, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 8, 2026

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @dpmehta! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

const { getBlock } = select( blockEditorStore );
const block = getBlock( clientId );
return {
hasInnerBlocks: !! ( block && block.innerBlocks.length ),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
hasInnerBlocks: !! ( block && block.innerBlocks.length ),
hasInnerBlocks: getBlockCount( clientId ) > 0,

We could use something like this here, make similar assertions easier, IMO.

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.

Thanks for your valuable feedback ! i have made changes and made assertions easier

@Mamaduka Mamaduka added [Type] Enhancement A suggestion for improvement. [Block] Quote Affects the Quote Block labels Apr 8, 2026
@dpmehta dpmehta requested a review from Mamaduka April 9, 2026 11:20
@Mamaduka
Copy link
Copy Markdown
Member

Thanks for the update, @dpmehta!

It looks like the appender was removed in #60307. Given this change, it might be better to fully reintroduce it and avoid adding extra logic to the block. cc @jasmussen

Since the default appender looks like a paragraph, it might seem that nothing happened after removal. Maybe a button appender is better suited for these cases, but it depends on how we handle the first question.

Screencast

CleanShot.2026-04-14.at.12.01.52.mp4

@dpmehta
Copy link
Copy Markdown
Contributor Author

dpmehta commented Apr 15, 2026

@Mamaduka Thanks for the reply, what should be the next step , we should wait for the suggestion right regarding reintroducing the appender ?

@Mamaduka
Copy link
Copy Markdown
Member

Let’s wait for additional feedback for now.

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

Labels

[Block] Quote Affects the Quote Block First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Block library /packages/block-library [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quote: backspace in a nested list should lead to a default block

2 participants