You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Button with a tooltip throws NotFoundError: removeChild when it unmounts inside a Lexical decorator #7580
A Button carrying a tooltip throws when it unmounts inside a Lexical
decorator node:
NotFoundError: Failed to execute 'removeChild' on 'Node':
The node to be removed is not a child of this node.
The decorator keeps working afterwards, but the error reaches the console (and
any test asserting a clean console), and the story is reported as failing to
render by Storybook's own error overlay.
Where I hit it
Building an image plugin for the RichText/RichTextEditor Playground story
(#7579). A DecoratorNode renders the image and, while the node is selected,
a row of Astryx Buttons beside it. Selecting the image mounts that row;
clicking elsewhere unmounts it, and the throw lands there.
Select the image (the button mounts), then click into the text (the button
unmounts) → the error.
What isolates it to tooltip
Three runs of the same scenario, same story, same build, each verified in
Chromium with the console collected:
Controls rendered in the decorator
Result on unmount
Astryx Button with tooltip
NotFoundError: removeChild
Astryx Button without tooltip
clean
Plain <button>
clean
The same tooltipped buttons mounted outside a decorator — in the editor's
toolbar, unmounted by toggling the toolbar off — also unmount cleanly. So it is
the combination of tooltip and the decorator subtree, not tooltip alone.
Guess at the mechanism
A Lexical decorator is a React portal into a DOM element Lexical owns and
removes on its own schedule, so React unmounts the subtree against a parent
that may already be detached. Anything the tooltip layer relocates (top layer,
anchor positioning) is then removed from a node that is no longer its parent.
Environment
main at 22743455aa, lexical 0.52.0, React 19.2.7, Chromium via Playwright.
Workaround
Drop tooltip from buttons rendered inside a decorator; #7579 does that, and
its labels carry the meaning on their own.
Activity