From e6d6e192d575c8c0e2e07767dfb866dd237733ac Mon Sep 17 00:00:00 2001 From: Chinesezjc Date: Mon, 3 Aug 2026 18:58:44 +0800 Subject: [PATCH] fix(ui-primitives): keep two-digit source markers out of the scroll clip Making `.sources` a scroll container turned its `padding-left` from spacing into a correctness constraint. A scroll container clips inline-start overflow with no way to scroll it back, and `::marker` is right-aligned to the content edge, so past nine sources the markers rendered as `0.` and `1.` where `10.` and `11.` belonged. `searchMaxResults` is an unbounded positive integer, so size the padding in `em` against the list's own font to hold a three-digit marker. The browser e2e measures a `999. ` marker in that inherited font and requires the computed padding to be at least that wide, pinning the room against the widest marker rather than one fixture's source count. --- ...6-08-03-web-search-source-scroll.i18n.yaml | 4 ++-- .../2026-08-03-web-search-source-scroll.md | 4 +++- .../2026-08-03-web-search-source-scroll.zh.md | 4 +++- apps/web/tests/web-search-round.e2e.ts | 19 +++++++++++++++++++ .../ui-primitives/src/WebBlock.module.css | 13 +++++++++++-- .../client/ui-primitives/src/WebBlock.tsx | 4 +++- 6 files changed, 41 insertions(+), 7 deletions(-) diff --git a/.agents/notes/implemented/feature/2026-08-03-web-search-source-scroll.i18n.yaml b/.agents/notes/implemented/feature/2026-08-03-web-search-source-scroll.i18n.yaml index 1e08a3f091..80f7ed4ab4 100644 --- a/.agents/notes/implemented/feature/2026-08-03-web-search-source-scroll.i18n.yaml +++ b/.agents/notes/implemented/feature/2026-08-03-web-search-source-scroll.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write .agents/notes/implemented/feature/2026-08-03-web-search-source-scroll.md -2026-08-03-web-search-source-scroll.md: fe98aca07fae9b6b3e612ae432f14cf5db462461 -2026-08-03-web-search-source-scroll.zh.md: 38573647d59d659c8cdec53a42913848d268c6be +2026-08-03-web-search-source-scroll.md: c11bb2317b6ae6cad8017a4b76cb0b9ccebd6fc0 +2026-08-03-web-search-source-scroll.zh.md: add012216589b33cf244d8a14053a5b6d60631a6 diff --git a/.agents/notes/implemented/feature/2026-08-03-web-search-source-scroll.md b/.agents/notes/implemented/feature/2026-08-03-web-search-source-scroll.md index fe98aca07f..c11bb2317b 100644 --- a/.agents/notes/implemented/feature/2026-08-03-web-search-source-scroll.md +++ b/.agents/notes/implemented/feature/2026-08-03-web-search-source-scroll.md @@ -20,6 +20,8 @@ That list is the one the model reads as long as nothing downstream of the tool r `CHAT_WEB_MAX_SOURCES` and the primitive's `DEFAULT_WEB_MAX_SOURCES` are removed: with scroll, the chat row and the details panel show the same full list, differentiated only by their container height. `
  • ` still pins each source's 1-based citation index; without the collapse gap the ordinals are now simply contiguous. +Making the list a scroll container also makes its `padding-left` a correctness constraint, not spacing. A scroll container clips inline-start overflow and offers no way to scroll it back, and `::marker` is right-aligned to the content edge, so a marker wider than the padding silently loses its leading digits — at the list's 20px the two-digit markers rendered as `0.` and `1.` where `10.` and `11.` belonged. `searchMaxResults` is an unbounded positive integer, so the padding is sized in `em` against the list's own font — the one a marker inherits — to hold a three-digit marker (`999. ` measures 2.35em in the app font stack) and keeps the gap the one-digit case already had. + ## Alternatives considered **Raise `searchMaxResults` (or make it unbounded) so more sources reach both the model and the card.** Rejected by the user: it changes model-side behavior (more sources into every request's context, more tokens) and widens the gap between what the model reads and what the card draws. The instruction was explicit — keep the cap and the truncation, add a scrollbar. @@ -36,7 +38,7 @@ Every source the tool returned is always in the DOM, so no source the view carri `packages/client/ui-primitives/tests/web-block.spec.tsx` drops the collapse cases (head/tail slice, expand-on-click, collapsed-tail numbering, expander-out-of-numbering, head-alone, default cap) and adds: a 30-source card renders all 30 `
  • ` with no `[aria-expanded]` and no `