Skip to content

Fix clipped markdown list markers with adaptive gutters - #5111

Merged
ymichael merged 1 commit into
mainfrom
bb/stop-clipping-two-digit-list-numbers-in-messages-thr_q78sze8v7c
Oct 7, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/stop-clipping-two-digit-list-numbers-in-messages-thr_q78sze8v7c

Conversation

@ymichael

@ymichael ymichael commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

The shared markdown renderer reserved 20px for outside ordered-list markers.
Two-digit markers exceeded the gutter and were clipped in collapsed user
bubbles. The earlier fixed 28px fix in 9e102e0 (#1759) was explicitly
reverted to 20px by 16ceb3a (#1765), without a regression test. A fixed
wider gutter also shifts single-digit lists unnecessarily.

What changed

Count direct items in each ordered list and calculate its widest marker from
its start and final number. Expose the digit count as a CSS variable and
add one ch per extra digit to the existing 20px padding-inline-start.
Single-digit lists keep their geometry; nested lists compute independently.
User and assistant markdown use the shared renderer. Unordered lists are
unchanged. Queued previews flatten lists into inline spans without markers.

Add focused Ladle story cases for both message roles: 1–9, 10–12,
98–101, and nested 7–11. These expose the geometry for the story smoke
and visual checks.

How you verified

  • A temporary Chromium geometry check failed with the original gutter: "1280px user:
    marker 10. needs 20.56px, but the computed gutter is 20px".
  • With the fix, the geometry check passed for both user and assistant
    messages at 1280px and 390px: single-digit gutters remain 20px, larger
    gutters grow only by the extra digits, start values are preserved, and
    all markers fit, including independently measured nested lists.
  • Reviewed before/after Ladle screenshots at 1280px and 390px. Capture-only
    browser changes stack story labels above messages and hide unrelated
    rows; production message styles are unchanged.
  • pnpm exec turbo run typecheck lint --filter=@bb/app passed; lint reported
    250 existing warnings and no errors.
  • The focused existing ordered-list start test passed through Turbo.
  • git diff --check passed.

AGENT GENERATED

## What was wrong

The shared markdown renderer reserved 20px for outside ordered-list markers.
Two-digit markers exceeded the gutter and were clipped in collapsed user
bubbles. The earlier fixed 28px fix in 9e102e0 (#1759) was explicitly
reverted to 20px by 16ceb3a (#1765), without a regression test. A fixed
wider gutter also shifts single-digit lists unnecessarily.

## What changed

Count direct items in each ordered list and calculate its widest marker from
its start and final number. Expose the digit count as a CSS variable and
add one ch per extra digit to the existing 20px padding-inline-start.
Single-digit lists keep their geometry; nested lists compute independently.
User and assistant markdown use the shared renderer. Unordered lists are
unchanged. Queued previews flatten lists into inline spans without markers.

Add focused Ladle story cases for both message roles: 1–9, 10–12,
98–101, and nested 7–11. These expose the geometry for the story smoke
and visual checks managed by the CI sweep.

## How you verified

- A temporary Chromium geometry check failed with the original gutter: "1280px user:
  marker 10. needs 20.56px, but the computed gutter is 20px".
- With the fix, the geometry check passed for both user and assistant
  messages at 1280px and 390px: single-digit gutters remain 20px, larger
  gutters grow only by the extra digits, start values are preserved, and
  all markers fit, including independently measured nested lists.
- Reviewed before/after Ladle screenshots at 1280px and 390px. Capture-only
  browser changes stack story labels above messages and hide unrelated
  rows; production message styles are unchanged.
- pnpm exec turbo run typecheck lint --filter=@bb/app passed; lint reported
  250 existing warnings and no errors.
- The focused existing ordered-list start test passed through Turbo.
- git diff --check passed.

> AGENT GENERATED
@ymichael
ymichael merged commit acde042 into main Oct 7, 2026
28 checks passed
@ymichael
ymichael deleted the bb/stop-clipping-two-digit-list-numbers-in-messages-thr_q78sze8v7c branch October 7, 2026 18:20
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.

1 participant