Repository navigation
Conversation
* fix(lists): size ordered list markers to their widest number Task toggles keep list span order, fixing fork-base checkbox shifts right by ancestor margins. * fix(android): align mixed nested list indents with iOS * fix(android): re-add only the toggled task and its ancestors, as upstream software-mansion#1005 does Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Julius Marminge <julius0216@outlook.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
Heads-up for whichever of this PR and #1006 lands second: they conflict in the Android list files of both the React Native package and |
|
Thanks for this, the fix is right and the test coverage is thorough. I reviewed it locally on both platforms and have two follow-up commits on top of 8407374. GitHub refuses maintainer pushes to this branch because your fork's parent is What the follow-ups change
Verified
Two notes
|
What/Why?
Ordered lists that reach
100.clip their markers: the marker column is sizedfor
99.(a fixed 20pt in the standalone iOS package) and numbers areright-aligned against it, so
100.draws as00.and1000.as00..Closes #1003.
Each ordered list now measures its widest rendered marker in the marker font and
widens its own column to fit;
markerMinWidthis still the floor. Task itemsdraw a checkbox, so their numbers do not count. In the React Native package and
the standalone Android package, lists that stay under 100 keep the current
99.column, so their layout is unchanged.
Lists nested under a widened item move with it, so nested markers stay next to
their own text instead of keeping their old position. A following list gets its
own column again.
The change covers all three packages:
react-native-enriched-markdown, Android and iOS.enriched-markdown-android: the same approach. Lists there always start at 1,so this matters from the 100th item.
enriched-markdown-ios: the column becomes the widest marker or the existing20pt, whichever is larger. At the default 16pt medium marker font
10.to99.already measure 21.5 to 24.6pt, so two-digit lists now get a column thatfits them, about 4.6pt wider. Task items keep aligning with their numbered
siblings, as they do today. Quotes inside a widened item, including ones a few
list levels down and lists inside those quotes, move by the extra width once.
One related Android fix in the React Native package: toggling a task checkbox
re-added the task's span at the end of the text's span list, and Android draws
leading margins in that order, so a nested task's checkbox moved right by its
ancestors' margins on every tap. The toggle now re-adds the task's spans and the
ancestor spans after them in their original order. The standalone Android
package already toggles in place and needed no change.
The iOS docs line for
markerMinWidthsaid0sizes the column to each marker,which was not what the code did; it now describes the new behavior.
Testing
react-native-enriched-markdownAndroid:OrderedListMarkerWidthTestrendersthrough the real renderer into a
StaticLayoutand records where markers aredrawn. It checks marker columns for short and wide lists, starts at 0, 98, 998
and 12345, nested and following lists,
markerMinWidth, bullets and tasksunder wide parents, three levels, RTL, anchored markers, and marker positions
across checkbox toggles.
react-native-enriched-markdowniOS:__tests__/ios/OrderedListMarkerWidthTests.mm(the first suite in thatdirectory) covers the same column and nesting rules;
yarn test:iospasses onan iOS 26.5 Simulator.
enriched-markdown-android:OrderedListMarkerWidthTest(8 tests, adaptedfor lists that always start at 1). 7 of them fail without the fix. The full
testDebugUnitTest,ktlintCheckandlintDebugpass.enriched-markdown-ios:OrderedListMarkerWidthTests(13 tests). 3 fail onmain; the others pin nesting, task and quote offsets that the widening mustkeep. The full package suite and
swiftlint lint --strict(0.65.0) pass.ordered_list_wide_markers_testfor the React Native example(short control, 98 to 101, 998 to 1001, nested under a wide parent) and for
the native iOS example (1 to 12 with a nested bullet), with baselines. I ran
every
list-tagged flow in capture mode onmainand on this branch, in theReact Native example on Android API 36 (Pixel 9) and iOS 26.5 (iPhone 17), and
in both native examples. Every existing list capture is pixel-identical
between
mainand this branch. My iOS environment (Xcode 27.0) does notreproduce the committed iOS baselines pixel for pixel even on
main, so thenew iOS baselines may need regenerating on your reference setup.
https://github.com/mwolson/tmp-enriched-markdown-issues/tree/main/ordered-list-marker-width
Screenshots
React Native example,
ordered_list_wide_markers_test:Native iOS example, two-digit list (the markers used to reach past the column
into the container's padding):
PR Checklist
listflows pass in capture mode; see Testingfor the pixel-exact baselines)