Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lexical-playground] Bug Fix: row height resizing for merged cells #7305

Merged

Conversation

kirandash
Copy link
Contributor

Description

Current behavior:

  • Row height resizing doesn't work correctly after merging cells
  • The height style is applied to the wrong row when resizing merged cells

Changes being added:

  • Fixed row height calculation logic in TableCellResizer plugin to properly handle merged cells:
    1. Added detection of full row merges by checking tableCellNode.getColSpan() === tableNode.getColumnCount()
    2. Updated row index calculation to apply height to:
      • First row (baseRowIndex) for full row merges
      • Last row (baseRowIndex + rowSpan - 1) for partial merges
  • Simplified height calculation logic to use direct cell heights
  • Added E2E test "Resize row with merged cells spanning multiple rows" to verify the behavior

Closes #7304

Test plan

Before

  • Insert a table
  • Merge cells (full row)
  • Try to resize the row height using the bottom resizer
  • Height adjustment is not applied
lexical-7304-bug.mov

After

  • Insert a table
  • Test full row merge:
    • Merge entire row and verify height adjustment is applied to the first row
    • Height resizing works as expected
  • All existing table tests passThis fixes the issue where resizing row heights doesn't work correctly
    after merging cells. The fix handles two scenarios:
  • Partial cell merges: height is applied to the last row
  • Full row merges: height is applied to the first row
lexical-7304-fix.mov

This fixes the issue where resizing row heights doesn't work correctly
after merging cells. The fix handles two scenarios:
- Partial cell merges: height is applied to the last row
- Full row merges: height is applied to the first row

Fixes facebook#7304
…llResizer

Use nullish coalescing operator (??) instead of explicit undefined check
for better readability
@facebook-github-bot facebook-github-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 Mar 7, 2025
Copy link

vercel bot commented Mar 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 7, 2025 1:19pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 7, 2025 1:19pm

@kirandash kirandash changed the title [@lexical-playground] Bug Fix: row height resizing for merged cells [lexical-playground] Bug Fix: row height resizing for merged cells Mar 7, 2025
@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Mar 7, 2025
Copy link
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

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

Works great! Nice job

@etrepum etrepum added this pull request to the merge queue Mar 8, 2025
Merged via the queue into facebook:main with commit 9fb1b3c Mar 8, 2025
43 checks passed
@etrepum etrepum mentioned this pull request Mar 11, 2025
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: [@lexical/table] Merging cells breaks control
3 participants