Fix $convertLayoutContainerElement always returning null#8156
Fix $convertLayoutContainerElement always returning null#8156danielalanbates wants to merge 1 commit intofacebook:mainfrom
Conversation
…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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Hi @danielalanbates! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
etrepum
left a comment
There was a problem hiding this comment.
If you add a test to show that this does fix the behavior and accept the CLA then I will review it
|
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. |
Fixes #6813
Summary
The
$convertLayoutContainerElementfunction inLayoutContainerNode.tsalways returnednullwhen importing HTML because it usedwindow.getComputedStyle()to readgrid-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 readingdomNode.style.gridTemplateColumnsdirectly. This works becauseexportDOM()already setsgridTemplateColumnsas an inline style on the exported element, so the value is available on thestyleproperty without needing computed styles.Test plan
exportDOM()sets inlinegridTemplateColumns, confirmingdomNode.stylewill have the valueThis 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