Repository navigation
fix(mobile): serialize a list the engine nested inside a paragraph (rich editor follow-up) - #22145
Conversation
`insertUnorderedList` puts the `<ul>` inside the `<p>` it was given rather than replacing it — measured on WebKit 26.4 and Chromium 147 both — and `blockMarkdown` read such a paragraph inline. A bullet list the user typed came back as the paragraph's own text with no marker, so it did not survive a markdown round trip, on the page and in the native WebView alike. The serializer now reads structure wherever the list sits: text before it is a paragraph, the list is a list, text after is a paragraph. The DOM is left as the engine made it and no branch asks which engine is running. The parse side needs no mirror — it already renders `- x` as a top-level `<ul>`, which is the shape the fixed serializer reports, and the flat control case pins that. The unit fixture is built through the paragraph's own `innerHTML`: the HTML parser closes a `<p>` before a `<ul>`, so a markup string on the editor gives two siblings and would measure the flat shape. Each case asserts the nesting it got before it reads anything. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe serializer now detects unordered and ordered lists nested inside paragraphs or divs. It separates surrounding inline text into Markdown blocks and serializes the lists independently. New round-trip tests cover bullet lists, numbered lists, and surrounding text. Browser tests verify Chromium and WebKit behavior, Markdown reloads, and the absence of CSP violations and console errors. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to Nested lists now serialize as separate Markdown blocks while preserving surrounding text, with regression coverage for affected browser behavior. The change is ready to merge with normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description explains the problem, implementation, scope, and verification results, but it omits several required template sections. It has no linked issue, visual proof or N/A statement, Testing section with required checkboxes, Review section, boundary declaration, Notes, or Checklist. Resolution Add the missing required sections. Include a linked issue after “Fixes #”, attach visual proof or write N/A with a reason, complete the Testing checkboxes and platform details, and complete the Review, Agent skill upstream boundary, Notes, and Checklist sections.
✨ Finishing Touches 💡 1📝 Generate docstrings
🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — serializer fix for a contenteditable engine nesting a list inside a paragraph, plus its unit and render coverage.
blocksAroundListsdispatch for list-bearing paragraphs —blockMarkdown'sp/divbranch now emits the paragraph's real blocks (inline runs and each<ul>/<ol>) instead of reading the paragraph inline and walking past the list.holdsUnownedListownership rule — a list whoseclosest('li')is null is a block wherever it sits, the mirror ofdirectNestedLists; lists owned by an item are still serialized bylistMarkdown.- Round-trip unit cases — bullet/ordered list nested in a
<p>(including WebKit's span + trailing<br>item) and text-list-text, each asserting thePnesting precondition and a flat-shape control. - Real-browser render case — presses Bullet list, asserts the engine nested the
<ul>in the<p>, asserts the reported change is- bullet round trip, then re-renders that markdown and waits for the flat list markup.
I verified the new unit cases are genuine guards: restoring the old inline dispatch makes exactly those 3 fail (3 failed | 10 passed), and the full rich-markdown directory passes (10 files / 88 tests). check:code-quality:changed reports 0 new findings. The ownership rule is consistent with listItemText/directNestedLists for lists nested inside a list item's <p>, and task lists are untouched.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

A list the engine nested inside a paragraph survives the markdown round trip
Why
Pressing the bullet-list command on a paragraph makes both engines nest the
<ul>inside the<p>rather than replace it (captured through the render rig, Chromium 147 and WebKit 26.4; WebKit additionally wraps the item text in a styled span with a trailing break). The serializer read the paragraph's text and walked past the list, so a bullet list did not survive a markdown round trip:- alphacame back asalpha. Numbered lists nest the same way, and leaving the list with two returns and typing yields<p><ul><li>solo</li></ul><div>after the list</div></p>, which read assoloafter the list. Found by C2's render check on 2026-09-21; recorded as WebKit-only, measured here as both.What
blockMarkdowninmobile/src/components/rich-markdown/html-block-markdown.tsdispatches a paragraph that carries a list toblocksAroundLists, which walks the children and emits a paragraph for each run of inline content and a list for each<ul>/<ol>, joined as blocks, recursing into an element child that itself holds such a list. The ownership question sits beside its mirror inhtml-list-markdown.tsasholdsUnownedList: a list whoseclosest('li')is null is a block wherever it sits; a list an item owns is left tolistMarkdown. Task lists and nested lists are untouched. No user-agent branch, no DOM normalisation, no type assertion. The parse side needs no mirror:- xalready renders as a top-level<ul>, the shape the fixed serializer reports, pinned by the flat control.Red before, green after
expected 'alpha\nbeta' to be '- alpha\n- beta'expected 'first\nsecond' to be '1. first\n2. second'expected 'before the listsoloafter the list' to be 'before the list\n\n- solo\n\nafter the list'expected 'bullet round trip' to be '- bullet round trip'Each unit case asserts
ul.parentElement.tagName === 'P'before reading, and the render case asserts the same nesting as a precondition, so if an engine ever stops nesting the case fails rather than passing vacuously. Trap recorded in the test:editor.innerHTML = '<p><ul>…'never builds the nested shape, because the HTML parser closes the<p>; the fixture sets the paragraph's owninnerHTML.Verification
Lane on
99aeeb391e: round-trip test 13 passed, render check 18 passed, full mobile suite 808 files,config/scripts251 files, tsc, ratchet, lints, anti-slop, changed-code quality all 0. Lead gate againstb9643365ba: all gates 0;config/scripts251 files passed; mobile 808 files passed; no machine paths.