fix(ListItem): support ReactNode for description prop, fix whiteSpace nowrap breaking line-clamp - #896
Merged
Conversation
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsList · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: 1 accessibility violation(s) found — 1 critical. XDSList - 1 issue(s)
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
… nowrap breaking line-clamp - Change `description` prop type from `string` to `ReactNode` - Split description styles: string descriptions keep single-line truncation (whiteSpace: nowrap + textOverflow: ellipsis), ReactNode descriptions get no wrapping constraints so children can manage their own text behavior - Update List.doc.mjs to reflect ReactNode type for description prop - Add tests for ReactNode description variants Fixes #890 Co-authored-by: Navi <navi@navibot.dev>
cixzhang
force-pushed
the
navi/fix/890-listitem-description-reactnode
branch
from
March 26, 2026 01:21
2edb729 to
bfeaf31
Compare
cixzhang
added a commit
that referenced
this pull request
Apr 26, 2026
… nowrap breaking line-clamp (#896) - Change `description` prop type from `string` to `ReactNode` - Split description styles: string descriptions keep single-line truncation (whiteSpace: nowrap + textOverflow: ellipsis), ReactNode descriptions get no wrapping constraints so children can manage their own text behavior - Update List.doc.mjs to reflect ReactNode type for description prop - Add tests for ReactNode description variants Fixes #890 Co-authored-by: Navi <navi@users.noreply.github.com>
cixzhang
added a commit
that referenced
this pull request
Jun 21, 2026
… nowrap breaking line-clamp (#896) - Change `description` prop type from `string` to `ReactNode` - Split description styles: string descriptions keep single-line truncation (whiteSpace: nowrap + textOverflow: ellipsis), ReactNode descriptions get no wrapping constraints so children can manage their own text behavior - Update List.doc.mjs to reflect ReactNode type for description prop - Add tests for ReactNode description variants Fixes #890 Co-authored-by: Navi <navi@users.noreply.github.com>
cixzhang
added a commit
that referenced
this pull request
Jun 21, 2026
… nowrap breaking line-clamp (#896) - Change `description` prop type from `string` to `ReactNode` - Split description styles: string descriptions keep single-line truncation (whiteSpace: nowrap + textOverflow: ellipsis), ReactNode descriptions get no wrapping constraints so children can manage their own text behavior - Update List.doc.mjs to reflect ReactNode type for description prop - Add tests for ReactNode description variants Fixes #890
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
Fixes #890 — two related issues with
XDSListItem:1.
descriptionprop now acceptsReactNodeChanged from
stringtoReactNodeso consumers can pass rich content (multiple text elements, conditional rendering, inline truncation):Backward compatible — plain strings still work exactly as before (single-line truncation applied automatically).
2. Fix
whiteSpace: 'nowrap'breaking-webkit-line-clampThe description wrapper previously applied
whiteSpace: 'nowrap'unconditionally. This silently broke any child component using-webkit-line-clamp(e.g.maxLinesonXDSText) because line-clamp requires text to be allowed to wrap.Fix: Split into two style objects —
descriptionString(withwhiteSpace: nowrap+textOverflow: ellipsis) applied only when description is a plain string; the basedescriptionstyle has no wrapping constraints for ReactNode.Changes
packages/core/src/List/XDSListItem.tsx— type change, split description styles, conditional style applicationpackages/core/src/List/List.doc.mjs— updated description prop type in docspackages/core/src/List/XDSList.test.tsx— 3 new tests for ReactNode description variants