fix: restore Shift+Cmd+Arrow selection expansion for MOVE_TO_END/MOVE_TO_START#8581
Merged
Conversation
…_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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
approved these changes
May 28, 2026
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
Follow-up to #8577. Restores
shiftKey: 'any'in theisMoveToStart/isMoveToEndmatchers so thatShift+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_STARThandlers that bail (return false) when the element contains only decorator nodes with no selectable text. The crash scenario (decorator-only elements callingselectEnd()/selectStart()) is handled regardless ofshiftKey.What was regressed by #8577
For mixed-content elements (inline decorator + text), the handlers need to fire on
Shift+Cmd+Arrowto correctly extend the selection past the inline decorator'scontenteditable=falseboundary — which native browser behavior fails to do on its own.Changes
shiftKey: 'any'in bothisMoveToStartandisMoveToEndmatcherstruefor shift variantsTest Plan
Existing tests cover both cases: