Skip to content

[lexical-playground][lexical-table] Bugfix: Fix the overlapping issue of table cell height resizer indicator#8571

Draft
dondomiedungca wants to merge 3 commits into
facebook:mainfrom
dondomiedungca:bugfix/fix-the-table-cell-height-resizer-indicator-overlapping-issue
Draft

[lexical-playground][lexical-table] Bugfix: Fix the overlapping issue of table cell height resizer indicator#8571
dondomiedungca wants to merge 3 commits into
facebook:mainfrom
dondomiedungca:bugfix/fix-the-table-cell-height-resizer-indicator-overlapping-issue

Conversation

@dondomiedungca

Copy link
Copy Markdown

Description

When the editor has table with many columns and the user will resize the table cell height, the indicator is overlapping from the editor container.

Before

Screenshot 2026-05-27 at 03 30 04

After

Screenshot 2026-05-27 at 03 31 28

…resizer indicator when table has many columns
@meta-cla

meta-cla Bot commented May 26, 2026

Copy link
Copy Markdown

Hi @dondomiedungca!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@vercel

vercel Bot commented May 26, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment May 30, 2026 5:01pm
lexical-playground Ready Ready Preview, Comment May 30, 2026 5:01pm

Request Review

@meta-cla

meta-cla Bot commented May 26, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@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 May 26, 2026
@potatowagon

Copy link
Copy Markdown
Contributor

Review: Table Cell Height Resizer Overlap Fix

Reviewed by: Navi (AI review assistant for @potatowagon)

Summary

This PR fixes the overlapping issue of the table cell height resizer indicator by computing the width relative to the editor's content-editable boundary rather than using the table width directly.

What I Verified

  • Logic correctness: The fix computes editorWidth - tableRect.left which correctly gives the distance from the table's left edge to the editor's right boundary, ensuring the resizer indicator doesn't extend beyond the visible editor area.
  • Edge case: Uses ?? 0 for the optional chaining fallback, which is safe — if the content-editable element isn't found, the indicator width defaults to 0 (invisible rather than broken).
  • Scope: Only affects the height (horizontal) resizer case; the vertical resizer is unchanged.
  • CI status: Only Vercel preview checks ran (no full e2e suite triggered for this playground-only change). Deployments succeeded.

Concern

The selector .ContentEditable__root is playground-specific. If this plugin is used outside the playground with a different class name, the resizer would get width 0. Consider using editor.getRootElement() instead for a more robust solution. However, since this is in lexical-playground, it's acceptable for now.

Verdict

Safe to approve — small, focused fix with clear intent. The playground-specific selector is the only minor concern but is appropriate for the file's context.

const editorWidth =
contentEditableElement?.getBoundingClientRect().right ?? 0;

styles[draggingDirection].width = `${editorWidth - tableRect.left}px`;

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.

Suggested change
styles[draggingDirection].width = `${editorWidth - tableRect.left}px`;
styles[draggingDirection].width = `${Math.min(tableRect.width, editorWidth - tableRect.left)}px`;

I don't think the intention here is to always size it to the end of the editor.

Comment on lines +421 to +423
const contentEditableElement = document.querySelector(
'.ContentEditable__root',
);

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.

Suggested change
const contentEditableElement = document.querySelector(
'.ContentEditable__root',
);
const contentEditableElement = editor.getRootElement();

@etrepum etrepum marked this pull request as draft June 1, 2026 05:24

@potatowagon potatowagon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review — Table Cell Height Resizer Indicator Fix

Assessment: Has minor concern ⚠️

What I verified:

  1. Bug fix logic: The fix changes the horizontal resize indicator width calculation from using tableRect.width (which only covers the table element) to spanning from the table's left edge to the editor's right edge. This prevents the indicator from overlapping/underlapping when the table doesn't fill the full editor width.

  2. CI status: All checks pass (limited CI run — CLA and Vercel only, no full test suite triggered).

Concern:

The fix uses document.querySelector('.ContentEditable__root') which is a hardcoded class name selector. This:

  • Couples the plugin to a specific CSS class name that's only guaranteed in the playground
  • Won't work for consumers using custom class names or different root element selectors
  • A more robust approach would be to use the editor's root element via editor.getRootElement()

This is a playground-only plugin change so it's lower risk, but the selector coupling is fragile. Consider using editor.getRootElement()?.getBoundingClientRect().right instead.

— via Navi on behalf of potatowagon

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants