Conversation
Hbrehman
marked this pull request as ready for review
September 12, 2026 18:40
prosemirror-tables' normalizeSelection clamped any TextSelection that left a table when $to.parentOffset === 0, and cell-drag handling refused to escape the table. That blocked mouse selection of a table plus neighbouring blocks and made native Ctrl/Cmd+A unreliable. Keep cell selection inside tables, but preserve TextSelections that span a table and other blocks. Add a Notion-style Mod-a keymap (first press selects the current block, second selects the document) that uses table-aware ranges so select-all works in documents that contain tables.
cursor
Bot
force-pushed
the
cursor/fix-table-cross-block-selection-b800
branch
from
September 12, 2026 18:41
165bf79 to
c96e9e4
Compare
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.
Summary
Documents that contain a table could not be selected together with neighbouring blocks, and Ctrl/Cmd+A did not select the whole document.
Rationale
Two
prosemirror-tablesbehaviours trapped the selection inside the table:normalizeSelectiontreated anyTextSelectionwith one endpoint in a cell and$to.parentOffset === 0as an accidental intra-table span, and clamped it back to a single cell. That is also the shape of a mouse selection that has just crossed from a table into the next paragraph, and of select-all when the document starts with a table and ends on an empty block.handleMouseDowncreates aCellSelectionand then refuses to update once the pointer leaves the table (inSameTable).BlockNote disables TipTap's core extensions, so there was no
Mod-akeymap and native select-all was unreliable.Changes
tableEditing()with a thin wrapper that:TextSelectionspanning the table and the pointerMod-akeymap (first press = current block, second = whole document,TextSelectionnotAllSelection). Table ranges use first/last cell text positions. Whole-doc endpoints that fall inside a table are expanded to the table node's boundaries so Backspace can delete the isolating table instead of only emptying its cells.getTableContentRange/getBlockContentRange/getWholeDocTextSelectionsosetSelectionand the keymap share the same table endpoints.Impact
Cell-to-cell selection inside a table is unchanged. Selections that start outside a table, or that drag out of one, can now include the table and neighbouring blocks.
Mod-ais now handled by the editor.Testing
tableCrossBlockSelection.test.ts:setSelectionacross paragraph+table and table+paragraphparentOffset === 0is not clampedMod-ain a table, then again, selects the whole documentMod-a+ Backspace clears documents that contain / start with a tableKeyboardShortcutsExtension.test.ts: Notion-style escalate-and-clear for paragraphs and checkliststableCrossBlockSelection.browser.test.tsfor mouse-drag (runs in the Docker e2e suite)packages/coreunit suite: 778 passedvp lint --type-awareon the changed core files: cleanScreenshots/Video
N/A (selection behaviour; covered by unit tests)
Checklist