← Back to Pull requests

[lexical-table] Bug Fix: The plain text of a table selection holds the text of a nested table once #9869

Closed
unknown closed this pull request without merging on Nov 12, 2026 09:42 UTC
View on GitHub
unknown unknown commented on Nov 10, 2026 22:04 UTC
Author

Description

When copying or cutting a table selection that contains a nested table, the nested table's text was appearing twice in the text/plain output.

The issue was in TableSelection.getTextContent(). It was collecting every TableCellNode returned by getNodes(), which also included cells from nested tables. Since the outer cell's text already contained the nested table's content, those nested cells were being added again, resulting in duplicate text. It also affected the tab spacing between cells that followed, since nested cells belong to a different row.

This change fixes the issue by making getTextContent() consider only cells that belong to the selected table. The same filtering is applied both when collecting the cells and when building the final text output.

Rows with no directly selected cells still retain their blank lines, so the existing formatting behavior is preserved. The HTML and Lexical JSON output were already correct and are unaffected by this change.

For example, consider a 2x2 table (A B / C D) where cell A contains a nested table with the text INNER. When selecting the entire table, the plain text output previously looked like this:

A

INNER
INNER
B
C	D

It now produces the expected output:

A

INNER	B
C	D

Closes #9755

Changeset

Added .changeset/table-selection-nested-text.md with a patch changeset for @lexical/table, including a [fix] entry and a Verify: paragraph.

Test plan

Before

https://github.com/user-attachments/assets/fc6b830e-99de-4a84-a211-03d461756bc2

After

https://github.com/user-attachments/assets/58633ef0-0156-4181-9dce-598de47a4a91

Diff: 208 lines (+156 / -52) across 2 files Reviewer: potatowagon Review duration: 2138m
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 208 lines diff across 2 files
0.36
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.320
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #9869"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 36.4% (MEDIUM) · Higher = larger blast radius
36.4%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 14.4% · Safe to merge
14.4%
Repository