Skip to content

[lexical][@lexical/table] Fix Ctrl+A to select all cells in table with merged cells #8074#8076

Merged
etrepum merged 2 commits intofacebook:mainfrom
aldoprogrammer:fix/table-ctrl-a-merged-cells
Jan 15, 2026
Merged

[lexical][@lexical/table] Fix Ctrl+A to select all cells in table with merged cells #8074#8076
etrepum merged 2 commits intofacebook:mainfrom
aldoprogrammer:fix/table-ctrl-a-merged-cells

Conversation

@aldoprogrammer
Copy link
Copy Markdown
Contributor

Description

  • Fix Ctrl+A so it selects all table cells (including merged cells) when a table is the only editor content.
  • Add table SELECT_ALL handler that only intercepts when the table is the sole root child.
  • Add regression tests: unit (SELECT_ALL scenarios) and E2E for merged-cell table-as-only-content.

Test plan

  • pnpm run test-unit -- lexical-table
  • pnpm run test-e2e-chromium -- packages/lexical-playground/tests/e2e/Tables.spec.mjs

Before

Ctrl+A fails to select all cells when the table contains merged cells and is the only element in the editor. see from issue demo #8074

After

Success to select all cells when the table contains merged cells and is the only element in the editor. Demo here

Closes #8074

@vercel
Copy link
Copy Markdown

vercel bot commented Jan 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
lexical Ready Ready Preview, Comment Jan 14, 2026 11:55pm
lexical-playground Ready Ready Preview, Comment Jan 14, 2026 11:55pm

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 14, 2026
@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Jan 14, 2026
editor.registerCommand(
SELECT_ALL_COMMAND,
$tableSelectAllCommand,
COMMAND_PRIORITY_HIGH,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be the lowest priority that implements the desired behavior which is probably this:

Suggested change
COMMAND_PRIORITY_HIGH,
COMMAND_PRIORITY_LOW,

const uniqueCellKeys = new Set(
selectedNodes.map((node) => node.getKey()),
);
const totalUniqueCells = new Set<string>();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally the NodeKey type alias is used any time keys are being used, even though it is currently indistinguishable from string.

Suggested change
const totalUniqueCells = new Set<string>();
const totalUniqueCells = new Set<NodeKey>();

@etrepum etrepum added this pull request to the merge queue Jan 15, 2026
Merged via the queue into facebook:main with commit 5b5ff14 Jan 15, 2026
39 checks passed
@aldoprogrammer aldoprogrammer deleted the fix/table-ctrl-a-merged-cells branch January 28, 2026 22:19
@etrepum etrepum mentioned this pull request Jan 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Ctrl+A fails to select all cells in table with merged cells when table is the only editor content

2 participants