Repository navigation
fix(MetadataListItem): a value breaks only a word longer than its line - #12472
josephfarina wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Changes requested: the side-by-side fix works, but the same swap regresses stacked lists.
- In stacked lists (labels on top,
orientation="horizontal", or numericcolumns), a URL or ID wider than the list now overflows it instead of wrapping (15 px past a 320 px list, and withcolumns={2}the page scrolls horizontally), because the stacked wrapper's minimum width is now its longest word; addingminWidth: 0tostyles.stackedWrapperinMetadataListItem.tsxrestores 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/0on 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.
| // 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. |
There was a problem hiding this comment.
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.
PR Analysis Report🔎 Preview ·
|
…e list; browser check measures reflow at 320 px
There was a problem hiding this comment.
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) becausestackedLabelinMetadataListItem.tsxhas no break rule, so give it the side-by-side label'swordBreak: '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.00in monospace). - Claim: the row squeezed an amount mid-number with a wider font: verified on the totals row markup (
$0.0/0under 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: 0the 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.
| // 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. |
There was a problem hiding this comment.
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.…column; browser check covers it
There was a problem hiding this comment.
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/.56in 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: 0the 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.
- #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]>
|
Landed in #12718. |
A
MetadataListItemvalue setword-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, ascomponent:MetadataListItemFR1 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 setsmin-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:
MetadataListReflow.a11y.chromium.spec.tsover 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'smin-width: 0the 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 computedoverflow-wrapisbreak-wordand itsword-breakis notbreak-word; both fail on the base.