Repository navigation
Add WordLikeStyles flight for list spacing and image alignment - #3482
Merged
Bryan Valverde U (BryanValverdeU) merged 8 commits intoNov 11, 2026
Merged
Bryan Valverde U (BryanValverdeU) merged 8 commits into
Bryan Valverde U (BryanValverdeU) merged 8 commits into
Conversation
Gate list spacing and default image alignment behind the opt-in WordLikeStyles experimental feature. Preserve existing behavior when disabled and explicit image alignment when enabled. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a37c6533-a7d0-4633-b0e9-3cbba6c613b8
|
Bryan Valverde U (BryanValverdeU)
marked this pull request as ready for review
October 29, 2026 16:37
Bryan Valverde U (BryanValverdeU)
requested review from
Jiuqing Song (JiuqingSong),
flyingbee2012,
Julia Roldi (juliaroldi) and
Vi Nguyen (vinguyen12)
and
a balanced review from Copilot
October 29, 2026 16:38
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a37c6533-a7d0-4633-b0e9-3cbba6c613b8
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The list inset is applied to individual inline formatting runs, creating gaps within mixed-format text while leaving plain-text list items without an inset.
1 open issue
What changed in this PR
Adds the opt-in WordLikeStyles feature to RoosterJS’s Content Model rendering, introducing list spacing and default image alignment while preserving behavior when disabled.
Changes:
- Add list-item bottom spacing and inline-start margins on direct element children.
- Default images to middle alignment when enabled, preserving explicit alignment.
- Add coverage for feature gating, LTR/RTL lists, cached list items, and image rendering.
| File | Description |
|---|---|
| packages/roosterjs-content-model-types/lib/editor/ExperimentalFeature.ts | Declare and document WordLikeStyles. |
| packages/roosterjs-content-model-dom/test/modelToDom/handlers/handleListItemTest.ts | Cover list spacing, direction, caching, and disabled behavior. |
| packages/roosterjs-content-model-dom/test/modelToDom/handlers/handleImageTest.ts | Verify image rendering with default middle alignment. |
| packages/roosterjs-content-model-dom/test/formatHandlers/common/verticalAlignFormatHandlerTest.ts | Cover gated defaults and explicit image alignment. |
| packages/roosterjs-content-model-dom/lib/modelToDom/handlers/handleListItem.ts | Apply gated list spacing while retaining accessibility roles. |
| packages/roosterjs-content-model-dom/lib/formatHandlers/common/verticalAlignFormatHandler.ts | Apply the gated image-alignment default. |
Review effort: Balanced
Preserve existing list margins, retain paragraph wrappers, and render direction-aware spacing from model formats. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a37c6533-a7d0-4633-b0e9-3cbba6c613b8
Bryan Valverde U (BryanValverdeU)
marked this pull request as draft
October 29, 2026 18:02
Accept browser-specific role and style attribute ordering in WordLikeStyles wrapper assertions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a37c6533-a7d0-4633-b0e9-3cbba6c613b8
Bryan Valverde U (BryanValverdeU)
marked this pull request as ready for review
November 2, 2026 19:08
Jiuqing Song (JiuqingSong)
approved these changes
Nov 10, 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.

Summary
Add the opt-in
WordLikeStylesexperimental feature for list spacing and image alignment. Enable it withexperimentalFeatures: ['WordLikeStyles']in the editor options; existing behavior is unchanged when the flight is disabled.margin-bottom: 2pxon list items andmargin-inline-start: 8pxon their direct element children, supporting both LTR and RTL layouts. Nested descendants are not directly styled, and accessibility roles remain unconditional.vertical-align: middle, bringing the image behavior from [Test] Default all images to vertical-align: middle #3473 behind the same flight. Preserve explicit image alignment.Screenshots
Image alignment
Before and after screenshots reused from #3473.
Before
After
List spacing
#Before

#After

How to test
yarn eslint,yarn test:fast, andyarn b.WordLikeStyles. Verify that list spacing and image alignment retain their existing behavior.experimentalFeatures: ['WordLikeStyles']. Verify that list items have2pxbottom spacing and their direct element children have8pxinline-start spacing in both LTR and RTL layouts.vertical-align: middle. Verify that images with explicittop,middle, orbottomalignment retain that alignment.