Skip to content

fix: restore Shift+Cmd+Arrow selection expansion for MOVE_TO_END/MOVE_TO_START#8581

Merged
etrepum merged 2 commits into
mainfrom
fix-restore-shift-selection-expansion
May 28, 2026
Merged

fix: restore Shift+Cmd+Arrow selection expansion for MOVE_TO_END/MOVE_TO_START#8581
etrepum merged 2 commits into
mainfrom
fix-restore-shift-selection-expansion

Conversation

@potatowagon
Copy link
Copy Markdown
Contributor

Summary

Follow-up to #8577. Restores shiftKey: 'any' in the isMoveToStart/isMoveToEnd matchers so that Shift+Cmd+Arrow (selection extension) dispatches through the custom handlers again.

Why this is safe

PR #8577 added defensive checks in the MOVE_TO_END/MOVE_TO_START handlers that bail (return false) when the element contains only decorator nodes with no selectable text. The crash scenario (decorator-only elements calling selectEnd()/selectStart()) is handled regardless of shiftKey.

What was regressed by #8577

For mixed-content elements (inline decorator + text), the handlers need to fire on Shift+Cmd+Arrow to correctly extend the selection past the inline decorator's contenteditable=false boundary — which native browser behavior fails to do on its own.

Changes

  1. Restores shiftKey: 'any' in both isMoveToStart and isMoveToEnd matchers
  2. Updates test expectations back to true for shift variants
  3. Updates test comment in decorator-only test to reflect the actual safety mechanism (handler bail, not matcher rejection)

Test Plan

Existing tests cover both cases:

  • Mixed-content with shift: selection extends past decorator ✅
  • Decorator-only with shift: handler returns false safely ✅

…_TO_START

Follow-up to #8577. Restores shiftKey:'any' in isMoveToStart/isMoveToEnd
matchers so that Shift+Cmd+Arrow (selection extension) dispatches through
the custom handlers again.

This is safe because #8577 already added defensive checks in the
MOVE_TO_END/MOVE_TO_START handlers that bail (return false) when the
element contains only decorator nodes with no selectable text. The crash
scenario (decorator-only elements) is handled regardless of shiftKey.

For mixed-content elements (decorator + text), the handlers correctly
extend the selection past the inline decorator boundary — which native
browser behavior fails to do on its own.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 28, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented May 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment May 28, 2026 6:17pm
lexical-playground Ready Ready Preview, Comment May 28, 2026 6:17pm

Request Review

@etrepum etrepum added this pull request to the merge queue May 28, 2026
Merged via the queue into main with commit d2cb77b May 28, 2026
45 checks passed
@etrepum etrepum mentioned this pull request May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants