Skip to content

Commit

Permalink
[lexical-playground][lexical-table] Bug Fix: Fix Shift+ `Down Arrow…
Browse files Browse the repository at this point in the history
…` regression for table sequence. (#6393)
  • Loading branch information
serey-roth authored Jul 11, 2024
1 parent 37daaed commit 1ecef21
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/lexical-table/src/LexicalTableSelectionHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1346,8 +1346,8 @@ function $handleArrowKey(
event.shiftKey &&
(direction === 'up' || direction === 'down')
) {
const anchorNode = selection.anchor.getNode();
if ($isRootOrShadowRoot(anchorNode)) {
const focusNode = selection.focus.getNode();
if ($isRootOrShadowRoot(focusNode)) {
const selectedNode = selection.getNodes()[0];
if (selectedNode) {
const tableCellNode = $findMatchingParent(
Expand Down Expand Up @@ -1387,17 +1387,17 @@ function $handleArrowKey(
}
return false;
} else {
const anchorParentNode = $findMatchingParent(
anchorNode,
const focusParentNode = $findMatchingParent(
focusNode,
(n) => $isElementNode(n) && !n.isInline(),
);
if (!anchorParentNode) {
if (!focusParentNode) {
return false;
}
const sibling =
direction === 'down'
? anchorParentNode.getNextSibling()
: anchorParentNode.getPreviousSibling();
? focusParentNode.getNextSibling()
: focusParentNode.getPreviousSibling();
if (
$isTableNode(sibling) &&
tableObserver.tableNodeKey === sibling.getKey()
Expand Down

0 comments on commit 1ecef21

Please sign in to comment.