Skip to content

Fix $convertLayoutContainerElement always returning null#8156

Open
danielalanbates wants to merge 1 commit intofacebook:mainfrom
danielalanbates:fix/issue-6813
Open

Fix $convertLayoutContainerElement always returning null#8156
danielalanbates wants to merge 1 commit intofacebook:mainfrom
danielalanbates:fix/issue-6813

Conversation

@danielalanbates
Copy link

Fixes #6813

Summary

The $convertLayoutContainerElement function in LayoutContainerNode.ts always returned null when importing HTML because it used window.getComputedStyle() to read grid-template-columns. Since the DOM nodes being imported are not mounted in the document, getComputedStyle() returns empty values for all properties.

Fix

Changed from window.getComputedStyle(domNode).getPropertyValue('grid-template-columns') to reading domNode.style.gridTemplateColumns directly. This works because exportDOM() already sets gridTemplateColumns as an inline style on the exported element, so the value is available on the style property without needing computed styles.

Test plan

  • Export a 2-column layout as HTML
  • Re-import the exported HTML — layout columns should now be preserved correctly
  • Verified that exportDOM() sets inline gridTemplateColumns, confirming domNode.style will have the value

This PR was created with the assistance of Claude Opus 4.6 by Anthropic. Happy to make any adjustments! Reviewed and submitted by a human.

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

…Style in layout container DOM conversion

getComputedStyle returns empty values for unmounted DOM nodes, causing
$convertLayoutContainerElement to always return null when importing HTML.
Since exportDOM sets gridTemplateColumns as an inline style, reading
domNode.style.gridTemplateColumns directly works for both mounted and
unmounted elements.

Fixes facebook#6813

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 19, 2026

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

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment Feb 19, 2026 7:38pm
lexical-playground Ready Ready Preview, Comment Feb 19, 2026 7:38pm

Request Review

@meta-cla
Copy link

meta-cla bot commented Feb 19, 2026

Hi @danielalanbates!

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!

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.

If you add a test to show that this does fix the behavior and accept the CLA then I will review it

@danielalanbates
Copy link
Author

Thanks for the feedback @etrepum! I'll look into signing the Meta CLA and adding a test case. I appreciate the guidance on what's needed to get this reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: The $convertLayoutContainerElement function of LayoutContainerNode always returns null

2 participants