Conversation
|
Is content loss caused by |
|
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. |
|
Size Change: +14 B (0%) Total Size: 7.74 MB 📦 View Changed
ℹ️ View Unchanged
|
|
Flaky tests detected in 4b20b65. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/24388285019
|
The issue is that we call a bunch of separate actions and only some of them are successful: gutenberg/packages/block-library/src/paragraph/use-enter.js Lines 107 to 125 in b8ea87d The process is
|
|
Possibly another way of fixing this is to make it work more like the list-item block, which does one big gutenberg/packages/block-library/src/list-item/hooks/use-enter.js Lines 75 to 79 in b8ea87d |
Yes, seems like a good opportunity to refactor, though it's not a blocker for this bug fix. |
ramonjd
left a comment
There was a problem hiding this comment.
Tests well according to instructions. Looks like a neat fix. Giving it a ✅ coz it fixes the bug, up to you if you wanna refactor here or later.
Also smoke tested adding paragraph in patterns and generally onEnter. Couldn't see any regressions. Thanks!
Mamaduka
left a comment
There was a problem hiding this comment.
Works as expected, and we have good e2e coverage of this behavior to catch any regression.
What?
Fixes a small issue originally noted here - #73222 (comment).
Why?
The paragraph block has a special
onEnterbehavior originally implemented here - #40724. When multiple blocks are inside some other containers (group, quote etc.), pressing 'enter' twice on a middle block splits a group in two:group-on-enter-in-middle.mp4
In the case of a group container, splitting means inserting a new group after the existing group.
It's possible the group might not be allowed. Unfortunately the existing code in trunk tries to insert the group, fails and then doesn't do anything. That's the behavior noted in #73222 (comment) where the content after the split disappears.
How?
The code does already check
canInsertBlockTypebefore trying to proceed with the split, but it only checks whether paragraphs can be inserted, so the fix is to augment this by also checking that a new group (or other container block type) can be inserted too.Testing Instructions
In trunk - paragraph 3 disappears.
In this branch - additional paragraphs are inserted before paragraph 3.
Screenshots or screencast
Before
Cap.2026-04-14.at.15.59.14.mp4
After
Cap.2026-04-14.at.16.08.01.mp4
Use of AI Tools
OpenCode / Claude