Repository navigation
Details Block: Fix block deletion, inner block behavior, and summary text selection - #87277
Open
sarthaknagoshe2002 wants to merge 2 commits into
Open
sarthaknagoshe2002 wants to merge 2 commits into
sarthaknagoshe2002 wants to merge 2 commits into
Conversation
🤖 PR meta 🤖🎉 PropsIf 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. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 🏷️ LabelsThis pull request needs exactly one label indicating its type, and has 0.
Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you. |
sarthaknagoshe2002
marked this pull request as ready for review
November 24, 2026 18:22
sarthaknagoshe2002
requested review from
ellatrix and
fabiankaegy
as code owners
November 24, 2026 18:22
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Closes #67767
Fixes four usability issues with the Details block:
Backspacein an empty summary now deletes the Details block.Backspaceinside an inner block no longer pushes it outside the Details block or deletes the entire Details block."Type / to add a hidden block"prompt instead of falling back to"Type / to choose a block".Why?
Backspacein an empty<summary>did nothing becauseRichTextlacked anonRemovehandler, making it difficult to delete the Details block on the canvas.core/detailsis registered under"category": "text",moveFirstItemUptreated it like a textual wrapper, ejecting populated inner blocks outside<details>whenBackspacewas pressed at index 0, or deleting the entirecore/detailscontainer whenBackspacewas pressed in an empty inner paragraph.core/detailswith zero inner blocks and caused the empty container to fall back to the generic"Type / to choose a block"prompt instead of"Type / to add a hidden block".<summary>text fired the native<summary>click toggle, collapsing or expanding the hidden content mid-selection.How?
packages/block-library/src/details/edit.jsx&editor.scss:onRemoveto the summaryRichTextso pressingBackspaceon an empty summary deletes the Details block.<summary>click toggling when selecting text insideRichText, while keeping disclosure marker andEntertoggling intact."Type / to add a hidden block"prompt remains visible after deleting or clearing inner content.packages/block-editor/src/components/block-list/block.tsx:moveFirstItemUpsocore/detailsdoes not push inner blocks outside<details>onBackspace, and removes only the empty inner block instead of the entire Details block.test/e2e/specs/editor/blocks/details.spec.js:Testing Instructions
▸) still toggles it."Type / to add a hidden block", place the cursor at the beginning of the text, and pressBackspace. Verify the paragraph stays inside the Details block.Backspaceagain (or delete the inner block via its toolbar⋮→ Delete). Verify the Details block and summary remain intact and a single"Type / to add a hidden block"prompt is displayed."Type / to add a hidden block"and verify a new paragraph is inserted with that same placeholder.Backspacein the empty summary. Verify the Details block is removed.Screenshots or screencast
Before
Screen.Recording.2026-11-23.at.6.57.21.PM.mov
After
Screen.Recording.2026-11-23.at.6.58.06.PM.mov
Use of AI Tools
AI coding tools were used to assist. All changes were reviewed, refined, and manually tested in the block editor.