[lexical-list] Bug Fix: indenting between two nested lists no longer converts the second list's type - #9118
Merged
etrepum merged 1 commit intoSep 11, 2026
Conversation
…converts the second list's type $handleIndent merged the sublist after an indented item into the one before it without comparing list types, so Tab between a nested bullet list and a nested numbered list turned the numbers into bullets. I guarded it on getListType(), as mergeNextSiblingListIfSameType does at the top level and facebook#9050 did for mergeLists and ListItemNode.remove.
Om-singhaI
requested review from
acywatson,
etrepum,
fantactuka,
ivailop7,
potatowagon and
zurfyx
as code owners
September 5, 2026 19:17
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
approved these changes
Sep 11, 2026
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
Pressing Tab on a list item between two nested sublists of different types silently rewrites the second sublist. Tab routes
INDENT_CONTENT_COMMANDtoListItemNode.setIndent, which calls$handleIndent. The item indents into the sublist above it, and the sublist below is emptied into it, so a nested<ol>and every item in it come back as bullets. A check sublist loses more:updateChildrenListItemValueclearscheckedoutside a check list.The caret is on
middle, between a nested bullet sublist and a nested numbered sublist. After Tab on main the numbered list is gone and its items are bullets:After Tab with this change, the item still indents and the numbered list keeps its type and children:
mergeNextSiblingListIfSameTypehas long stated this rule at the top level: "<ul>will merge with<ul>, but NOT<ul>with<ol>." #9050 carried it to two nested merge sites,mergeListsandListItemNode.remove, the latter handling this very shape and joining the surrounding sublists only whengetListType()matches. The branch of$handleIndentwith a nested sublist on both sides merges the same way and was missed.This change guards that merge on the same
getListType()equality, so a sublist of another type stays where it is instead of being appended and removed.Test plan
Three tests in the
$handleIndentblock ofpackages/lexical-list/src/__tests__/unit/formatList.test.tscover bullet then number, number then bullet, and bullet then check, the last assertingcheckedsurvives. A fourth pins the same type case.Before
The three new tests against the previous
formatList.ts:After
26 passed. All 15 unit files in
packages/lexical-listpass, 146 tests, plusLexicalListPlugin.test.tsx.eslintandprettierare clean. Browser and e2e not run.