Repository navigation
[lexical] Bug Fix: Ctrl+ArrowLeft/Right no longer jumps to line start/end - #9068
Closed
sahiee-dev wants to merge 1 commit into
Closed
sahiee-dev wants to merge 1 commit into
sahiee-dev wants to merge 1 commit into
Conversation
…/end (meta#8958) isMoveToStart()/isMoveToEnd() treated Ctrl on Windows/Linux as equivalent to Cmd on Mac, same as letter shortcuts like Bold. But arrow-key line jumps are a macOS-only gesture (Windows/Linux use Home/End instead and reserve Ctrl+Arrow for word navigation), so plain Ctrl+ArrowLeft was being hijacked into a jump to the start of the block instead of moving back one word - most noticeable in blocks starting with an inline decorator, where Lexical intercepts the key to work around a Chromium caret bug.
sahiee-dev
requested review from
acywatson,
etrepum,
fantactuka,
ivailop7,
potatowagon and
zurfyx
as code owners
August 13, 2026 19:05
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
reviewed
Aug 13, 2026
etrepum
left a comment
Collaborator
There was a problem hiding this comment.
metaKey only means that the windows key would perform this action, it sounds like a mac-only shortcut would be preferred here. Either way I think it would be best to wait for #8876 to land before making any changes to built-in shortcuts.
Contributor
Author
|
Good catch on metaKey, Windows key would technically match there, that's a fair point. |
etrepum
added a commit
to mayrang/lexical
that referenced
this pull request
Aug 13, 2026
This branch was successfully deployed
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.
Description
isMoveToStart()/isMoveToEnd()treated Ctrl on Windows/Linux as equivalent to Cmd on Mac, the same way letter shortcuts like Bold treat them.However, jumping to the start/end of a line with an arrow key is a macOS only gesture. Windows/Linux use the Home/End keys for this and reserve Ctrl+Arrow for word-by-word navigation.
As a result, plain Ctrl+ArrowLeft/Right on Windows/Linux was being hijacked into a jump to the start/end of the block instead of moving one word at a time.
This was most noticeable in blocks starting with an inline decorator, such as a Date chip, where Lexical already intercepts the key to work around a separate Chromium caret bug. That interception was firing unconditionally regardless of where the caret actually was in the block.
I dug deep and found that, This
ctrlKey/metaKeymixup goes back to the original 2022 implementation (#2257) and was later carried into a shared, platform aware constant by #7443 without accounting for the differences in arrow key behavior between platforms. This likely went unnoticed until #8558 widened the handler from code blocks to general rich text.This PR scopes
isMoveToStart()/isMoveToEnd()to only match onmetaKey(Cmd). This leaves Ctrl+Arrow on Windows/Linux alone so it can fall through to native word navigation, while Cmd+Arrow on macOS keeps its existing behavior unchanged.Closes #8958
Test plan
Before
The cursor jumps all the way to the start of the paragraph instead of moving back one word.
After
Follow the same steps. Ctrl+ArrowLeft now moves the cursor back one word at a time, as expected.
Verified manually on Windows.
Cmd+ArrowLeft/Right on macOS is unaffected and still jumps to the block start/end past the decorator, as covered by the existing #8555/#8601/#8604 tests.
Added
packages/lexical/src/__tests__/unit/LexicalUtils.test.tswithisMoveToEnd() / isMoveToStart() reject plain Ctrl+Arrow (#8958). The test asserts that Ctrl+ArrowLeft/Right no longer match, while Cmd+ArrowLeft/Right still do.