facebook / lexical

Lexical is an extensible text editor framework that provides excellent reliability, accessibility and performance.
https://lexical.dev
MIT License
17.5k stars 1.45k forks source link

Bug: Passing an empty ParagraphNode to $dfs incorrectly returns content from subsequent paragraphs #5976

Closed matsuyama-k1 closed 2 weeks ago

matsuyama-k1 commented 2 weeks ago

Lexical version: 0.14.5

Steps To Reproduce

  1. create empty ParagraphNode and following ParagraphNodes
  2. search empty paragraph with $dfs returns following paragraph nodes too

Link to code example: https://codesandbox.io/p/sandbox/icy-smoke-3j6p79

The current behavior

$dfs returns next paragraph contents when pass empty paragraph.

Screenshot 2024-04-27 at 18 35 11

The expected behavior

$dfs returns only itself when pass empty paragraph.