[lexical] Bug Fix: Respect CSS display style in isBlockDomNode and isInlineDomNode#8428
Merged
etrepum merged 3 commits intoApr 30, 2026
Conversation
… isInlineDomNode Fixes facebook#8418. When pasting from Ghostty terminal, `<div style="display: inline">` elements were treated as block elements, inserting unwanted linebreaks. The `isBlockDomNode` and `isInlineDomNode` functions now check the element's `style.display` property before falling back to the tag name.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
cmiiw, im gonna assume this fix is for all can be copying ghostty content and pasting it into the lexical playground. or, go to codepen to render |
Contributor
Author
|
Updated the test plan with before/after screen recordings showing the fix in action. |
etrepum
approved these changes
Apr 30, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #8418
When pasting from Ghostty terminal into Lexical,
<div style="display: inline">elements were treated as block elements, inserting unwanted linebreaks. This is becauseisBlockDomNodeandisInlineDomNodeclassified elements based solely on tag name, ignoring the CSSdisplayproperty.The fix checks
element.style.displaybefore falling back to the tag name. If an explicit display style is set, it takes precedence — a<div style="display: inline">is now treated like a<span>during import, which matches actual browser rendering behavior.This also handles
display: inline-block,display: inline-flex, etc., following the existing pattern inLexicalTextNode.ts.Test plan
Before:
<div style="display: inline;">wrappers8428Before.mov
After:
Same paste produces text on the same line, no extra linebreaks
Normal
<div>elements (without inline display) still create new lines as expectedAdded 2 unit tests (generic inline div + Ghostty-specific paste)
All 2,781 unit tests pass
pnpm run ci-checkpasses (TypeScript, Flow, Prettier, ESLint)Manual testing in playground confirms fix
8428after.mov