Skip to content

[lexical-selection] Bug Fix: don't throw reading the parent style of a slot value - #8950

Merged
etrepum merged 2 commits into
meta:mainfrom
LeSingh1:fix-8937-slot-nav
Aug 7, 2026
Merged

etrepum merged 2 commits into
meta:mainfrom
LeSingh1:fix-8937-slot-nav

Conversation

@LeSingh1

@LeSingh1 LeSingh1 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

$getComputedStyleForParent called getParentOrThrow, but a named-slot value has no parent — it links up to its host through __slotHost. The arrow-key handlers in @lexical/rich-text call $isParentRTL on the selection anchor, and the anchor is the slot value itself whenever the caret sits in an emptied slot or beside a decorator inside one. Moving between two adjacent slots therefore threw Expected node N to have a parent. and left the editor unable to accept typed input.

Reproduced with the playground document from the issue (a pullquote host whose attribution slot is a bare paragraph containing an image): ArrowLeft/ArrowRight across the slot boundary throws on every press.

This resolves the parent with getParent() and returns null when there is none — the same result the function already produces for a node with no DOM element, which every caller handles.

Fixes #8937

…a slot value

$getComputedStyleForParent called getParentOrThrow, but a named-slot value has
no parent — it links up to its host through __slotHost. The arrow-key handlers
in @lexical/rich-text call $isParentRTL on the selection anchor, and the anchor
is the slot value itself whenever the caret sits in an emptied slot or beside a
decorator inside one, so moving between adjacent slots threw "Expected node N
to have a parent." and left the editor unusable.

Resolve the parent with getParent() and return null when there is none, the
same result the function already produces for a node with no DOM element.

Fixes meta#8937
@vercel

vercel Bot commented Aug 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 Aug 7, 2026 5:59pm
lexical-playground Ready Ready Preview Aug 7, 2026 5: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 Aug 7, 2026
@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Aug 7, 2026
@etrepum
etrepum added this pull request to the merge queue Aug 7, 2026
Merged via the queue into meta:main with commit 0c637b8 Aug 7, 2026
44 checks passed
@etrepum etrepum mentioned this pull request Aug 31, 2026

This branch was successfully deployed

2 active deployments
Preview – lexical — 7fe00cdb Deployed Aug 7, 2026 by vercel[bot]
Preview – lexical-playground — 7fe00cdb Deployed Aug 7, 2026 by vercel[bot]
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: Keyboard navigation between slots throws an exception

2 participants