Quote: Ensure paragraph placeholder appears after deleting nested blocks#77151
Quote: Ensure paragraph placeholder appears after deleting nested blocks#77151dpmehta wants to merge 2 commits intoWordPress:trunkfrom
Conversation
…deleted via backspace
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
👋 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 ), |
There was a problem hiding this comment.
| hasInnerBlocks: !! ( block && block.innerBlocks.length ), | |
| hasInnerBlocks: getBlockCount( clientId ) > 0, |
We could use something like this here, make similar assertions easier, IMO.
There was a problem hiding this comment.
Thanks for your valuable feedback ! i have made changes and made assertions easier
|
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. ScreencastCleanShot.2026-04-14.at.12.01.52.mp4 |
|
@Mamaduka Thanks for the reply, what should be the next step , we should wait for the suggestion right regarding reintroducing the appender ? |
|
Let’s wait for additional feedback for now. |
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 torenderAppender: 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
Screenshots or screencast
Before
quote-block-inserter-before.mov
After
quote-block-inserter-after.mov
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.