Skip to content

[Breaking Change][lexical] Bug Fix: Include shadow root in $getReconciledDirection#8479

Merged
etrepum merged 5 commits into
facebook:mainfrom
ibastawisi:reconciled-dir
May 9, 2026
Merged

[Breaking Change][lexical] Bug Fix: Include shadow root in $getReconciledDirection#8479
etrepum merged 5 commits into
facebook:mainfrom
ibastawisi:reconciled-dir

Conversation

@ibastawisi

@ibastawisi ibastawisi commented May 7, 2026

Copy link
Copy Markdown
Contributor

Breaking Change

Since direction reconciliation now affects the root and shadow root nodes consistently, more nodes will have dir="auto" set when rendered in the editor. While this is expected to only affect behavior in a positive way, if you have tests that snapshot the HTML that the editor renders you may have to adjust them if you are not normalizing for this already.

Description

This pull request makes a minor update to the direction reconciliation logic in LexicalReconciler.ts by replacing the $isRootNode check with a more general $isRootOrShadowRoot check. This ensures that both root and shadow root nodes are handled consistently when determining text direction.

  • Updated direction reconciliation to use $isRootOrShadowRoot instead of $isRootNode when checking parent nodes in $getReconciledDirection, improving support for shadow roots. [1] [2]

Test plan

Before

image

After

image

@vercel

vercel Bot commented May 7, 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 8, 2026 3:59pm
lexical-playground Ready Ready Preview, Comment May 8, 2026 3:59pm

Request Review

@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 7, 2026
@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label May 7, 2026

@etrepum etrepum left a comment

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.

It looks like this needs changes to test expectations, and it should probably add some new ones to confirm that it's doing the right thing

@etrepum etrepum left a comment

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.

This seems good to me, although perhaps we should call it out as a breaking change?

@ibastawisi

Copy link
Copy Markdown
Contributor Author

This seems good to me, although perhaps we should call it out as a breaking change?

it might break tests but I don’t think it'd break anything else, so yeah it’s a good idea to point it out.

@etrepum etrepum changed the title [lexical] Bug Fix: Include shadow root in $getReconciledDirection [Breaking Change][lexical] Bug Fix: Include shadow root in $getReconciledDirection May 9, 2026
@etrepum etrepum added this pull request to the merge queue May 9, 2026
Merged via the queue into facebook:main with commit f3507d2 May 9, 2026
41 checks passed
@etrepum etrepum mentioned this pull request May 28, 2026
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.

2 participants