Skip to content

fix(MetadataListItem): a value breaks only a word longer than its line - #12472

Closed
josephfarina wants to merge 3 commits into
mainfrom
josephfarina/metadata-value-keeps-words
Closed

josephfarina wants to merge 3 commits into
mainfrom
josephfarina/metadata-value-keeps-words

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

A MetadataListItem value set word-break: break-word. That value (a legacy alias) lets the browser break a word anywhere when it computes the value's narrowest width, so the narrowest width of a value drops to one character. In a row such as an amount beside its description, the row then squeezes the amount and breaks it mid-number ("$0.0" / "0") on a phone, as soon as the font is a little wider (a monospace theme font, a larger text size).

The value now uses overflow-wrap: break-word: a word longer than its whole line (a URL, an ID) still wraps, as component:MetadataListItem FR1 requires ("break long words"), but each word keeps its own width as the value's narrowest width, the same rule Text uses for untruncated text (Text and Heading FR3). The label cell is unchanged. In stacked lists (labels on top, a horizontal list, numeric columns) the item's wrapper now sets min-width: 0, so its narrowest width is no longer its longest word and a URL or ID wider than the list wraps inside it instead of widening the list. A stacked label now breaks a word longer than its column the same way the side-by-side label already does, so it never runs into the next column.

Measured in Chromium on the order detail page template at 390 px with a monospace body font: the Shipping value "$0.00" had a narrowest width of 10.5 px and wrapped onto two lines; it now keeps 52.5 px and stays on one line. Desktop widths are unchanged.

Test plan:

  • New browser check MetadataListReflow.a11y.chromium.spec.ts over no-visual stories at 320 px: an amount beside a long description stays on one line; a long URL wraps inside the list side by side, stacked, horizontal and in two columns, with no sideways page scroll; a label word longer than its column in a two-column list breaks inside its column. Measured locally on the same layouts: without the wrapper's min-width: 0 the stacked, horizontal and two-column cases overflow by 196-258 px; with it, 0.
  • CI=1 vitest run packages/core/src/MetadataList (49 pass). New: side by side and stacked, the value's computed overflow-wrap is break-word and its word-break is not break-word; both fail on the base.
  • Prettier on the touched files.

@vercel

vercel Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 18, 2026 12:38am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 17, 2026
@astracat-bot

astracat-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 18, 2026, 12:58 AM UTC

@astracat-bot astracat-bot Bot 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.

Changes requested: the side-by-side fix works, but the same swap regresses stacked lists.

  • In stacked lists (labels on top, orientation="horizontal", or numeric columns), a URL or ID wider than the list now overflows it instead of wrapping (15 px past a 320 px list, and with columns={2} the page scrolls horizontally), because the stacked wrapper's minimum width is now its longest word; adding minWidth: 0 to styles.stackedWrapper in MetadataListItem.tsx restores wrapping.
  • The changeset's "A word longer than the whole line still wraps", the matching code comment and the stacked test title are not true for those stacked lists until that fix lands, and the test checks only a computed style, which cannot show the overflow.

The side-by-side change itself checks out: an amount such as $0.00 stays whole in a tight row, a long URL beside its label still wraps, and both new tests fail on the base as described. A shorter wording for the new code comment is suggested inline (non-blocking).

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claim: a value no longer splits an ordinary word or number when its row is tight (an amount beside its description, wider font): verified in Chromium on a copy of the order detail totals.
  • Claim: a word longer than the whole line still wraps: verified beside a label; false for stacked, horizontal and top-label column lists.
  • Claim: the old rule dropped the value's narrowest width to one character: verified (8.4 px at a 14 px monospace font).
  • Claim: the row squeezed the amount mid-number on a phone with a wider font: verified ($0.0 / 0 on the base).
  • Claim: the new rule keeps each word's width as the narrowest width, the rule Text uses: verified against Text's own styles and record.
  • Claim: the label cell is unchanged: verified.
  • Claim: the shipping amount's narrowest width grows and it stays on one line: verified in direction (8.4 px to 42.2 px in our copy).
  • Claim: desktop widths are unchanged: verified (identical frames at a desktop-width card).
  • Claim: the MetadataList tests pass (49) and both new cases fail on the base: verified.
  • Claim: Prettier passes on the touched files: verified.
  • File .changeset/metadata-value-keeps-words.md: finding (the wrap claim is false for stacked lists).
  • File packages/core/src/MetadataList/MetadataListItem.tsx: blocking finding (stacked overflow); non-blocking comment wording.
  • File packages/core/src/MetadataList/MetadataList.test.tsx: finding (the stacked test title overstates what it checks); otherwise clear.

Automated review (maintainer link)

Comment on lines +67 to +72
// A value breaks a word only when the word is longer than its line, so a long
// URL or ID wraps instead of overflowing. `overflow-wrap: break-word` keeps
// each word's own width as the value's narrowest width, so a value in a row
// (an amount beside its description) is never squeezed into breaking an
// ordinary word or number. `word-break: break-word` would drop that narrowest
// width to a single character.

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.

Non-blocking (comment style): the second sentence runs 33 words and covers two topics, and the first is not yet true for stacked items. Suggested:

// A word longer than its line wraps. `break-word` keeps each word's width as
// the minimum, so a tight row does not split an amount. `word-break:
// break-word` would shrink that minimum to one character.

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 54672be

Storybook · Sandbox · built from this PR's head

Current run: The current CI run concluded cancelled. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

…e list; browser check measures reflow at 320 px

@astracat-bot astracat-bot Bot 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.

Changes requested: the stacked-list overflow from the last review is fixed, but the stacked wrapper's new min-width: 0 lets a long label run into the next column.

  • In a stacked list with numeric columns, a label word longer than its column now overprints the neighbouring item (a 205 px label in a 128 px column at 320 px) because stackedLabel in MetadataListItem.tsx has no break rule, so give it the side-by-side label's wordBreak: 'break-word' and add a long-label case to the new browser check.

The value fix itself checks out: an amount beside its description stays on one line at 320 px, a long URL still wraps in all four layouts exactly as before, and both new unit tests fail on the base. Two non-blocking comment-wording suggestions are inline.

Claims and files checked

Review mode: full; reason: history

  • Claim (changeset): a Core patch release: verified, only Core source changes and no public API moves.
  • Claim (changeset): a value no longer breaks an ordinary word or number in a tight row, such as an amount beside its description on a phone with a wider font: verified (2 lines on the base, 3 in monospace; 1 line on this head).
  • Claim (changeset): a word longer than the whole line still wraps: verified side by side, stacked, horizontal and in two columns, with no sideways scroll.
  • Claim: the old rule let the value's narrowest width drop to one character: verified (8.4 px against 42.2 px for $0.00 in monospace).
  • Claim: the row squeezed an amount mid-number with a wider font: verified on the totals row markup ($0.0 / 0 under the old rule).
  • Claim: the value now follows the wrapping rule Text and Heading use: verified in the code and both component records.
  • Claim: the label cell is unchanged: verified for its style; the stacked label's layout changes through the wrapper (the finding above).
  • Claim: stacked lists give the item's wrapper min-width: 0, so a long URL or ID wraps inside the list: verified.
  • Claim: on the order totals at 390 px in monospace the amount's narrowest width grows and it stays on one line: verified in direction (8.4 px to 42.2 px here; exact pixels depend on the font size).
  • Claim: desktop widths are unchanged: verified (five MetadataList stories identical at 1280 px and 320 px).
  • Claim: the new browser check covers an amount on one line and a long URL wrapping in four layouts at 320 px, on stories kept out of visual baselines: verified (it passes all 5 cases in CI on this head, and equivalent measurements here agree).
  • Claim: without the wrapper's min-width: 0 the stacked cases overflow, and with it they do not: verified in direction (289 to 358 px here; amounts depend on the font).
  • Claim: the MetadataList tests pass (49) and both new cases fail on the base: verified.
  • Claim: Prettier passes on the touched files: verified.
  • File .changeset/metadata-value-keeps-words.md: clear.
  • File apps/storybook/stories/MetadataListReflowA11y.stories.tsx: clear.
  • File packages/core/src/MetadataList/MetadataList.test.tsx: clear.
  • File packages/core/src/MetadataList/MetadataListItem.tsx: blocking finding (stacked label overlap); non-blocking comment wording at two comments.
  • File packages/core/src/MetadataList/__tests__/MetadataListReflow.a11y.chromium.spec.ts: clear; it should gain a long-label case with the fix.

Automated review (maintainer link)

Comment on lines +100 to +103
// Stacked layout wrapper (label on top). A grid or flex item's narrowest
// width is its longest word unless it sets `min-width: 0`; without it, a URL
// or ID wider than the list would widen the wrapper past the list instead
// of wrapping inside it.

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.

Non-blocking (comment style): the second sentence runs 38 words on two topics. Suggested:

// Stacked layout wrapper (label on top). A grid or flex item cannot shrink
// below its longest word. `min-width: 0` lets a long URL or ID wrap inside
// the list.

@astracat-bot astracat-bot Bot 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.

Approved pending CI: the CI run on this head was cancelled because CI was full, so CI needs a re-run before merge.

The stacked-label overlap from the last review is fixed: a label word longer than its column now breaks inside the column, where the base pushed the page 47 px sideways at 320 px. The value fix keeps an amount on one line beside its description, long URLs still wrap in all four layouts, and the new unit cases and the amount and label browser cases fail on the base and pass here. The two earlier comment-wording suggestions are still open and non-blocking.

Claims and files checked

Review mode: incremental; reason: none

  • Claim (changeset): a Core patch release: verified; only Core source changes, and the API report shows no change in Core or the seven themes.
  • Claim (changeset): a value no longer breaks an ordinary word or number in a tight row, such as an amount beside its description on a phone with a wider font: verified (2 lines on the base, 3 in monospace; 1 line on this head, at 320 px).
  • Claim (changeset): a word longer than the whole line still wraps: verified side by side, stacked, horizontal and in two columns, with no sideways scroll.
  • Claim: the value used the legacy word-break: break-word: verified in the base styles for the side-by-side and stacked value.
  • Claim: that rule drops the value's narrowest width to one character: verified (8 px on the base against 63.6 px here for the amount).
  • Claim: a tight row split an amount mid-number with a wider font: verified on the row story ($1, / 234 / .56 in monospace).
  • Claim: the value now uses overflow-wrap: break-word, keeps the long-word wrap and follows the rule Text and Heading use: verified in the code and both component records.
  • Claim: the label cell is unchanged: verified for the side-by-side label, whose style is untouched; the stacked label change is stated separately.
  • Claim: stacked lists give the item's wrapper min-width: 0, so a long URL or ID wraps inside the list: verified in three layouts.
  • Claim: a stacked label breaks a word longer than its column, like the side-by-side label: verified (3 lines inside a 128 px column; page overflow 47 px on the base, 0 here).
  • Claim: on the order totals at 390 px in monospace the amount keeps its width and stays on one line: verified in direction on the row story (8.4 px to 75.9 px); the template's exact pixels depend on its font size.
  • Claim: desktop widths are unchanged: verified (six MetadataList stories pixel-identical at 1280 px and 320 px).
  • Claim: the new browser check covers the amount, a long URL in four layouts and a long label in two columns at 320 px, on stories kept out of visual baselines: verified (6 of 6 pass here; the amount and label cases fail on the base).
  • Claim: without the wrapper's min-width: 0 the stacked cases overflow, and with it they do not: verified in direction (289 to 358 px here; amounts depend on the font).
  • Claim: the MetadataList tests pass (49) and both new cases fail on the base: verified.
  • Claim: Prettier passes on the touched files: verified (ESLint is clean too).
  • File .changeset/metadata-value-keeps-words.md: clear.
  • File apps/storybook/stories/MetadataListReflowA11y.stories.tsx: clear.
  • File packages/core/src/MetadataList/MetadataList.test.tsx: clear.
  • File packages/core/src/MetadataList/MetadataListItem.tsx: clear; two non-blocking comment-wording suggestions remain from the last review.
  • File packages/core/src/MetadataList/__tests__/MetadataListReflow.a11y.chromium.spec.ts: clear.

Automated review (maintainer link)

josephfarina added a commit that referenced this pull request Nov 18, 2026
josephfarina added a commit that referenced this pull request Nov 19, 2026
josephfarina added a commit that referenced this pull request Nov 19, 2026
- #12252 docs(cli): agent docs name the prop names that differ from other libraries
  Author: Joey Farina <[email protected]>
- #12154 fix(core): a numeric typography weight builds through an extended base's adaptation rules
  Author: Joey <[email protected]>
- #12092 fix(cli): theme build reads the Core it builds with for variant declarations, and names the build command alone
  Author: Joey Farina <[email protected]>
- #12316 fix(core): a shorthand never follows its own longhand in one style merge
  Author: josephfarina <[email protected]>
- #12357 fix(core): a Table stays the scroll region when a host scrolls every table's parent
  Author: Joey Farina <[email protected]>
- #12349 fix(core): end a mouse drag a sandboxed frame never saw released
  Author: josephfarina <[email protected]>
- #12425 fix(cli): use a stored doc parse only with the zod release that made it
  Author: Joey <[email protected]>
- #12396 fix(AppShell): with the standard width points, a server-rendered shell hides its inline side nav on a phone before its script runs
  Author: Joey <[email protected]>
- #12438 fix(charts): end dots draw whole and a thinned axis keeps its last label
  Author: Joey Farina <[email protected]>
- #12448 fix(cli): upgrade outside a project names the project, not --from
  Author: Joey Farina <[email protected]>
- #12459 fix(templates): the dashboard scorecard fits a phone screen
  Author: Joey Farina <[email protected]>
- #12428 fix(core): Field labels draw in a bolder face than their description
  Author: Joey Farina <[email protected]>
- #12435 fix(theme-matcha): dark menus, popovers and muted fills take the theme's deep gray neutral
  Author: Joey <[email protected]>
- #12432 fix(templates): dashboard chart labels show whole instead of clipped by the chart edge
  Author: Joey Farina <[email protected]>
- #12441 fix(cli): mark icon-set generated calls pure so apps drop unused icons
  Author: Joey Farina <[email protected]>
- #12472 fix(MetadataListItem): a value breaks only a word longer than its line
  Author: Joey <[email protected]>
@josephfarina

Copy link
Copy Markdown
Contributor Author

Landed in #12718.

@github-actions
github-actions Bot deleted the josephfarina/metadata-value-keeps-words branch November 19, 2026 06:05

This branch was successfully deployed

1 active deployment
Preview — 54672be4 Deployed Nov 18, 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. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant