[lexical-rich-text] Bug Fix: Fix right and up arrow key navigation with decorator nodes (#7393)

Co-authored-by: Bob Ippolito <bob@redivi.com>
This commit is contained in:
Kiran Dash
2025-03-28 06:43:47 +08:00
committed by GitHub
parent 7d59a1a995
commit 5e56647bbe

View File

@ -747,10 +747,7 @@ export function registerRichText(editor: LexicalEditor): () => void {
KEY_ARROW_UP_COMMAND,
(event) => {
const selection = $getSelection();
if (
$isNodeSelection(selection) &&
!$isTargetWithinDecorator(event.target as HTMLElement)
) {
if ($isNodeSelection(selection)) {
// If selection is on a node, let's try and move selection
// back to being a range selection.
const nodes = selection.getNodes();
@ -839,10 +836,7 @@ export function registerRichText(editor: LexicalEditor): () => void {
KEY_ARROW_RIGHT_COMMAND,
(event) => {
const selection = $getSelection();
if (
$isNodeSelection(selection) &&
!$isTargetWithinDecorator(event.target as HTMLElement)
) {
if ($isNodeSelection(selection)) {
// If selection is on a node, let's try and move selection
// back to being a range selection.
const nodes = selection.getNodes();