Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1499,7 +1499,7 @@ test.describe.parallel('Selection', () => {
await assertSelection(page, {
anchorOffset: 0,
anchorPath: [2],
focusOffset: 1,
focusOffset: 0,
focusPath: [1, 1, 0],
});
});
Expand Down Expand Up @@ -1544,7 +1544,7 @@ test.describe.parallel('Selection', () => {
await assertSelection(page, {
anchorOffset: 0,
anchorPath: [1],
focusOffset: 1,
focusOffset: 0,
focusPath: [0, 1, 0],
});
},
Expand Down Expand Up @@ -1659,7 +1659,7 @@ test.describe.parallel('Selection', () => {
await assertSelection(page, {
anchorOffset: 0,
anchorPath: [2],
focusOffset: 1,
focusOffset: 0,
focusPath: [1, 1, 0],
});
});
Expand Down
6 changes: 3 additions & 3 deletions packages/lexical-table/src/LexicalTableSelectionHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1045,11 +1045,11 @@ export function applyTableHandlers(
);
const firstCell = tableMap[0][0].cell;
const lastCell = tableMap[tableMap.length - 1].at(-1)!.cell;
// When backward, focus should be at START of first cell (0)
// When forward, focus should be at END of last cell (getChildrenSize)
newSelection.focus.set(
isBackward ? firstCell.getKey() : lastCell.getKey(),
isBackward
? firstCell.getChildrenSize()
: lastCell.getChildrenSize(),
isBackward ? 0 : lastCell.getChildrenSize(),
'element',
);
} else if (isAnchorInside) {
Expand Down