Skip to content

feat(chat): add ChatMessageList align prop for top-aligned lists - #3933

Merged
cixzhang merged 1 commit into
meta:mainfrom
jiunshinn:feat/2572-chatmessagelist-align
Aug 24, 2026
Merged

cixzhang merged 1 commit into
meta:mainfrom
jiunshinn:feat/2572-chatmessagelist-align

Conversation

@jiunshinn

Copy link
Copy Markdown
Contributor

Summary

Adds align?: 'top' | 'bottom' (default 'bottom') to ChatMessageList. 'bottom' preserves today's behavior; 'top' omits the internal spacer so messages start at the top and grow downward — for log-style / document-style lists.

Closes #2572.

Why

The bottom-pinning spacer was hardcoded and unconditionally rendered, and xstyle only reaches the root (ChatMessageList.tsx:275 pre-change), so consumers had no way to opt out. Top-aligned lists previously required swizzling.

Behavior delta

Case align='bottom' (default) align='top'
List shorter than container Spacer fills free space → messages pinned to bottom (unchanged) Spacer omitted → messages start at top
List overflows container Spacer collapses to 0; scrolls to bottom Spacer absent; scrolls to bottom (identical)
ChatLayout auto-scroll unchanged unchanged (spring early-returns when scrollHeight <= clientHeight, useChatStreamScroll.ts:142)

Implementation (ChatMessageList.tsx)

  • Prop + JSDoc at the interface (:78-93), destructure with default align = 'bottom' (:227)
  • {align === 'bottom' && <div {...stylex.props(styles.spacer)} aria-hidden />} (:313-317) — was an unconditional div

SYNC / docs

File header + component JSDoc, ChatMessageList.doc.mjs (en/zh/dense), new Alignment Storybook story, changeset. Chat/index.ts unchanged (the existing type re-export already covers the new prop) — deliberately kept untouched to avoid conflicting with #3800.

Test plan

4 new cases (spacer present for default & bottom, absent for top, children render under top). Full Chat suite 141/141 green; core typecheck clean.

@vercel

vercel Bot commented Jul 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jul 14, 2026 5:21pm

Request Review

@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge labels Jul 14, 2026
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.6KB 0B

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | View full report

@jiunshinn
jiunshinn marked this pull request as ready for review July 14, 2026 17:25

@cixzhang cixzhang 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.

Thanks — this is exactly what #2572 asked for, and omitting the spacer rather than zeroing it is the right cut. Would merge as is.

[Reviewed by Robohands]

@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Aug 23, 2026
@cixzhang
cixzhang enabled auto-merge (squash) August 24, 2026 00:50
@cixzhang
cixzhang merged commit 6759843 into meta:main Aug 24, 2026
23 checks passed
cixzhang added a commit that referenced this pull request Aug 24, 2026
…d size scale

#3933 landed a story with size="small" after #4140 replaced Avatar's named
sizes with the abbreviated scale, so build-storybook's typecheck fails on
main and blocks every PR based on it.
cixzhang added a commit that referenced this pull request Aug 24, 2026
… widen it to the trigger line (#5377)

* refactor(MultiSelector): rename formatTriggerCount to formatValue and widen it to the trigger line

formatValue now receives the selected items ({value, label}[]) and formats
the trigger for triggerDisplay 'count' and 'labels'; 'badges' renders
elements, so it is excluded. The prop is unreleased, so no codemod or
deprecation is needed. Defaults are unchanged when the prop is absent.

* fix(storybook): Chat story uses Avatar size 'sm' after the abbreviated size scale

#3933 landed a story with size="small" after #4140 replaced Avatar's named
sizes with the abbreviated scale, so build-storybook's typecheck fails on
main and blocks every PR based on it.
cixzhang added a commit that referenced this pull request Aug 24, 2026
…tory (#5381)

Avatar's named scale became `xsm | sm | md | lg | xl` (#4140); the align story
landed afterwards with `size="small"` (#3933), so `pnpm -F
@astryxdesign/storybook typecheck` fails on main and takes the `build` job with
it. Every open PR is blocked behind it.

Every other Avatar in the file uses a token from the current scale.
@github-actions
github-actions Bot deleted the feat/2572-chatmessagelist-align branch August 24, 2026 06:59
AKnassa added a commit to AKnassa/astryx that referenced this pull request Aug 27, 2026
AKnassa added a commit to AKnassa/astryx that referenced this pull request Aug 27, 2026
`align="top"` (meta#3933) omits the bottom spacer, so the anchor (the
spacer's next sibling) was null and a top-aligned list lost its
reading position on every prepend.

- Anchor on the first message element: after the spacer, else after
  the spinner while a load is pending, else after the sentinel. Same
  at the prepended check. The spinner step matters when a load fires
  as the previous one resolves: anchoring the spinner disarms as soon
  as it unmounts.
- Share the scrollable-ancestor walk with Outline via
  utils/getScrollableAncestor (internal; utils/index is public API).
  Outline keeps its overflow requirement by default; ChatMessageList
  opts out, since an underfilled list's scroller cannot scroll yet.
- Add a top-aligned variant of the Load Earlier History story.

Adds 3 tests for align="top" and 7 for the helper.

Refs meta#4102

This branch was successfully deployed

1 active deployment
Preview — da411de3 Deployed Jul 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

XDSChatMessageList: add an align/anchor prop for top-aligned message lists

2 participants