Skip to content

Fix Word Desktop nested list spacing - #3469

Open
Bryan Valverde U (BryanValverdeU) wants to merge 2 commits into
masterfrom
u/bvalverde/fixNestedListsSpacing
Open

Bryan Valverde U (BryanValverdeU) wants to merge 2 commits into
masterfrom
u/bvalverde/fixNestedListsSpacing

Conversation

@BryanValverdeU

@BryanValverdeU Bryan Valverde U (BryanValverdeU) commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes Word Desktop nested list spacing by preserving Word's vertical list paragraph margins while removing duplicated horizontal indentation from nested list levels and nested list item formats.

Before this change, pasted nested bullets could gain extra top spacing and duplicated indentation because Word list paragraphs were converted into generated lists while still carrying conflicting horizontal spacing. After this change, the pasted nested list layout aligns more closely with the source Word content.

Screenshots

Source

Screenshot 2026-10-05 160052

Before

Screenshot 2026-10-05 160005

After

Screenshot 2026-10-05 160033

How to test

  1. Run the full test suite:

    yarn test:fast
  2. Paste the Word Desktop nested bullets sample into the editor.

    • Before this fix: nested bullets have extra spacing/indentation.
    • After this fix: nested bullets preserve the expected Word-style spacing and alignment.

Validation

  • yarn test:fast passed locally with TOTAL: 6483 SUCCESS.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 12a1ef28-2e75-4648-a2a2-c149b4436919

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The shorthand parser corrupts valid margins containing whitespace inside CSS functions.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Preserves Word Desktop list spacing while preventing duplicated nested indentation.

Changes:

  • Preserve vertical margins while removing horizontal margins.
  • Remove redundant nested-list indentation.
  • Update unit, integration, and paste tests.
File Description
removeListParagraphMargins.ts Preserves vertical margins.
processWordLists.ts Removes nested horizontal indentation.
removeListParagraphMarginsTest.ts Updates margin tests.
processPastedContentFromWordDesktopTest.ts Updates content-model expectations.
wordNestedListMarginTest.ts Adds nested-list regression coverage.
cmPasteFromWordTest.ts Updates end-to-end expectations.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +52 to +55
const values = value
.substring(0, importantMatch?.index ?? value.length)
.trim()
.split(/\s+/);
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://microsoft.github.io/roosterjs/pr-preview/pr-3469/

Built to branch gh-pages at 2026-10-05 23:01 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Parse margin shorthand by top-level whitespace so CSS function values such as calc() and var() are preserved when removing horizontal Word list margins.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 12a1ef28-2e75-4648-a2a2-c149b4436919

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants