Fix cross-block text selection delete across nested blocks#78771
Draft
ellatrix wants to merge 1 commit into
Draft
Fix cross-block text selection delete across nested blocks#78771ellatrix wants to merge 1 commit into
ellatrix wants to merge 1 commit into
Conversation
Backspace or Delete on a text selection running from an outer block into its own nested descendant previously did nothing: the selection observer promoted such selections to a block-level multi-selection, and the store's merge and delete paths bailed on any selection that did not start and end in the same block list. - use-selection-observer: when one endpoint is an ancestor of the other, dispatch a rich-text selectionChange instead of promoting to multiSelect. - __unstableIsSelectionMergeable: allow cross-parent selections with a determinable document order via an isClientIdBefore helper. - __unstableDeleteSelection: order endpoints through the parent chain; merged content always lands in the ancestor, also for forward Delete; the end block's inner blocks survive onto the merged block, matching the sibling-selection behavior. Adds e2e coverage for the two-level Backspace and Delete cases and a three-level Backspace case. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ellatrix
force-pushed
the
fix/list-multiselect-backspace
branch
from
July 18, 2026 05:23
b5ae898 to
2528519
Compare
|
Size Change: +176 B (0%) Total Size: 7.73 MB 📦 View Changed
|
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 #76233.
Backspace or Delete on a text selection that spans a nested list item (e.g. from the middle of an outer item to the middle of its own nested item) now deletes the selected range and merges the remaining content, instead of silently doing nothing.
Why?
The selection observer promoted ancestor/descendant selections to a block-level multi-selection, and the store's merge/delete paths bailed on any selection that did not start and end in the same block list.
How?
use-selection-observer.js: detect when one selection endpoint is an ancestor of the other and dispatch a rich-textselectionChangeinstead of promoting tomultiSelect.__unstableIsSelectionMergeable: drop the same-parent gate; determine document order via parent-chain comparison.__unstableDeleteSelection: support ancestor/descendant endpoints; the merged content always lands in the ancestor (also for forward Delete, which previously targeted the descendant).Notes
ab[ul[cd, xy]], selecting from mid-"ab" to mid-"cd" also removes "xy").Testing Instructions
Covered by three e2e tests in
list.spec.js(2-level Backspace, 3-level Backspace, 2-level Delete).Use of AI Tools
Authored with Claude Code under direction and review.