diff --git a/.changeset/single-line-word-break.md b/.changeset/single-line-word-break.md new file mode 100644 index 0000000000000..345f742ff3bbe --- /dev/null +++ b/.changeset/single-line-word-break.md @@ -0,0 +1,8 @@ +--- +'@astryxdesign/cli': patch +'@astryxdesign/core': patch +--- + +[feat] Change the single-line Text and Heading truncation default from `break-all` to `break-word`; pass `wordBreak="break-all"` to opt into splitting inside words + +@bezabyte diff --git a/apps/storybook/stories/Text.stories.tsx b/apps/storybook/stories/Text.stories.tsx index 2e62a62d6ac34..de21cb7be366b 100644 --- a/apps/storybook/stories/Text.stories.tsx +++ b/apps/storybook/stories/Text.stories.tsx @@ -410,7 +410,7 @@ export const WordBreakVariants: Story = {
- break-word (default for multi-line): + break-word (default for truncation):
@@ -420,7 +420,7 @@ export const WordBreakVariants: Story = {
- break-all (default for single-line): + break-all (explicit opt-in):
diff --git a/docs/specs/components/Heading/Heading.spec.md b/docs/specs/components/Heading/Heading.spec.md index d16eec2b0a8a7..47d70b7761fa3 100644 --- a/docs/specs/components/Heading/Heading.spec.md +++ b/docs/specs/components/Heading/Heading.spec.md @@ -35,15 +35,15 @@ system_specs: [spec:AST-009, spec:AST-024] ## Contract at a glance -| Area | Contract | -| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Public contract | A semantic heading with a required `level`, an optional theme-extensible visual `type`, `weight`, `accessibilityLevel`, and the shared text controls documented in `Heading.doc.mjs`. | -| Behavior | `level` picks `h1`–`h6` and the default visual scale; `type` and `weight` change only appearance; `accessibilityLevel` sets `aria-level` when it differs. | -| End-user impact | Screen-reader users navigate a document outline that matches the page's sections, whatever size each heading is drawn at. | -| Builder impact | A long unbroken token in non-truncated Heading wraps. Inside a flex row, the flex child needs `min-width: 0` for the wrap to apply, and a caller's own container that sets `overflow-wrap: anywhere` does not reach Heading's text; Core's `anywhere` containers pass their wrap to it. The truncation Tooltip mounts on the first hover, completed tap or focus (AR3). | -| Compatibility/readiness | Released behavior recorded as current, with one styling output change and one DOM change: non-truncated Heading sets `overflow-wrap` (`break-word`, or `anywhere` inside Core's `anywhere` containers). The truncation Tooltip mounts on the first hover, completed tap or focus, so until then a clamped Heading has no tooltip layer, and it never adds `aria-describedby` (AR3). No API change. One implementation gap is listed under Current-state impact. | -| Review checks | Reject a visual `type` or `weight` that changes the element or level, a heading that renders without a level baseline, or a duplicate native tooltip for truncation. | -| Governing rules | `spec:AST-024` (custom visual types, weight precedence, unchanged accessibility); `architecture:component-theming-surface/INV6,INV14`; `architecture:public-component-api/INV5,INV6,INV8`. | +| Area | Contract | +| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Public contract | A semantic heading with a required `level`, an optional theme-extensible visual `type`, `weight`, `accessibilityLevel`, and the shared text controls documented in `Heading.doc.mjs`. | +| Behavior | `level` picks `h1`–`h6` and the default visual scale; `type` and `weight` change only appearance; `accessibilityLevel` sets `aria-level` when it differs. | +| End-user impact | Screen-reader users navigate a document outline that matches the page's sections, whatever size each heading is drawn at. | +| Builder impact | A long unbroken token in non-truncated Heading wraps. Inside a flex row, the flex child needs `min-width: 0` for the wrap to apply, and a caller's own container that sets `overflow-wrap: anywhere` does not reach Heading's text; Core's `anywhere` containers pass their wrap to it. The truncation Tooltip mounts on the first hover, completed tap or focus (AR3). | +| Compatibility/readiness | Released behavior recorded as current, with one styling output change and one DOM change: non-truncated Heading sets `overflow-wrap` (`break-word`, or `anywhere` inside Core's `anywhere` containers). The truncation Tooltip mounts on the first hover, completed tap or focus, so until then a clamped Heading has no tooltip layer, and it never adds `aria-describedby` (AR3). No prop change. One default change: with `maxLines={1}`, `wordBreak` defaults to `break-word` instead of `break-all` (FR4), a nonbreaking typography default; `wordBreak="break-all"` keeps the old split. One implementation gap is listed under Current-state impact. | +| Review checks | Reject a visual `type` or `weight` that changes the element or level, a heading that renders without a level baseline, or a duplicate native tooltip for truncation. | +| Governing rules | `spec:AST-024` (custom visual types, weight precedence, unchanged accessibility); `architecture:component-theming-surface/INV6,INV14`; `architecture:public-component-api/INV5,INV6,INV8`. | This table is a review projection; the body below is authoritative. @@ -57,9 +57,12 @@ Heading's own contract. ## Compatibility and migration -- Released default preserved: `yes` -- Compatibility class: one styling output change and one DOM change, with - no public prop or default change: non-truncated Heading sets `overflow-wrap` +- Released default preserved: `no`: with `maxLines={1}`, `wordBreak` defaults + to `break-word` instead of `break-all` (FR4) +- Compatibility class: one styling output change, one DOM change and one + nonbreaking typography default change, with no public prop change. With + `maxLines={1}`, `wordBreak` defaults to `break-word` instead of `break-all`, + and `wordBreak="break-all"` keeps the old split (FR4). Non-truncated Heading sets `overflow-wrap` (`break-word`, or `anywhere` inside Core's `anywhere` containers), so a long unbroken token wraps (FR3). The truncation Tooltip mounts on the first hover, completed tap or focus (AR3): before that, a clamped Heading has no closed @@ -112,7 +115,7 @@ Consumer migration instructions belong in consumer docs and release notes. | FR1 | `level` renders `h1`–`h6`; a numeric string reads as its number. A missing level, or one that is not a number or numeric string from 1 to 6, renders `h2` at the level 2 scale. `accessibilityLevel` adds `aria-level` only when it differs from `level`. | Current source and tests | | FR2 | The heading carries the `heading` target reflecting `level`, `color`, and any supplied `type` and `weight`. A built-in `type` applies its display scale and default weight; otherwise the level's scale applies. A theme-added `type` keeps the level's scale as its baseline. An explicit `weight` wins over the type and level defaults. | Current source and tests | | FR3 | `color` defaults to `primary`; a theme-added color keeps the primary baseline until a theme paints it. `hasCapsize` renders `block` and trims to cap height; otherwise `maxLines` above 1 renders the line-clamp box, `maxLines={1}` renders `block`, and otherwise `display` (default `block`) applies. `justify` uses logical values; `start`, the default, sets no alignment, so the element follows its container's. `textWrap` and `hasStrikethrough` apply their text treatments. Without truncation, a token longer than its line wraps, so in ordinary flow the text does not force horizontal scrolling at 320 CSS px (`spec:AST-020` FR1, WCAG 2.2 1.4.10 Reflow). The heading's `overflow-wrap` is `break-word`, which keeps min-content, so tables and auto-sized columns lay out ordinary words unchanged; inside a Core container that wraps its content with `anywhere` (CommandPaletteEmpty, Toast, FieldStatus, Banner), it is `anywhere`, as the container's own text is. A flex child needs `min-width: 0` from its container, and a caller's own container that sets `overflow-wrap: anywhere` does not reach the heading's text. | Current source and tests | -| FR4 | `maxLines={1}` clips one line with an ellipsis; a larger value clamps to that many lines unless `hasCapsize` is set, whose `block` display removes the clamp. With truncation, `wordBreak` defaults to `break-all` for one line and `break-word` otherwise. When the text is measured as truncated and `hasTruncateTooltip` is not `false`, a lazily loaded Tooltip anchored to the heading shows the full text at the given placement (default `above`); no native `title` is added. `hasTruncateTooltip={false}` takes no measurement. A truncation tooltip can be opened from the keyboard (WCAG 2.2 2.1.1). Implementation gap: the tooltip opens on hover and touch only, because the heading is not focusable (Current-state impact). | Current source and tests | +| FR4 | `maxLines={1}` clips one line with an ellipsis; a larger value clamps to that many lines unless `hasCapsize` is set, whose `block` display removes the clamp. With truncation, `wordBreak` defaults to `break-word` for both one line and multiple lines; callers can pass `break-all` when splitting inside words is intentional. When the text is measured as truncated and `hasTruncateTooltip` is not `false`, a lazily loaded Tooltip anchored to the heading shows the full text at the given placement (default `above`); no native `title` is added. `hasTruncateTooltip={false}` takes no measurement. A truncation tooltip can be opened from the keyboard (WCAG 2.2 2.1.1). Implementation gap: the tooltip opens on hover and touch only, because the heading is not focusable (Current-state impact). | Current source and tests | | FR5 | `ref` reaches the heading element. Supported DOM, ARIA, data, and event props reach it after the derived `aria-level`, so a caller `aria-level` wins; `xstyle`, `className`, and `style` merge in that order after component styles, with the line clamp applied after `style`. | Current source and tests | ### Allowed variation @@ -189,18 +192,18 @@ Tooltip. ## Verification map -| Contract | Verification | Representative states | Mutation or failure expectation | Audit section | -| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------ | -| FR1, AR2 | `Heading.test.tsx` level and `accessibilityLevel` tests | Levels 1–6; differing and equal override | A wrong element, a missing `aria-level` for a differing override, or an `aria-level` added for an equal one fails. | `audit:Heading/a11y` | -| FR2 | `Heading.test.tsx` target, type, theme-added type, weight, and omitted-type tests; `extensibleAxes.test.ts`; `HeadingAudit.a11y.chromium.spec.ts` on the AuditMatrix story | Display types, theme-added type, weight | A lost `heading` class or `data-level`, `data-color`, `data-type`, or `data-weight` reflection, a reflected omitted type, or a theme-added type losing its level baseline fails. Display sizes out of order, or an explicit `bold` no heavier than the display default, fails the browser spec. Gap: the level scales and the level default weights have no paint check. | `audit:Heading/theming` | -| FR3 | Stable visual baseline `core-heading--level-1`; `Heading.stories.tsx`; `HeadingAudit.a11y.chromium.spec.ts` | Level 1 default; secondary color; `center` and `end` alignment | A changed level-1 scale, color, or display comes back changed for review; a `justify` that does not resolve to logical `center` or `end`, or heading text below its WCAG contrast threshold, fails the browser spec. Gap: `display` precedence, `textWrap`, cap-height trim, strikethrough, and the theme-added color baseline have no automated check. | `audit:Heading/behavior` | -| FR3 (reflow) | `Heading.test.tsx` long unbroken tokens; `TextReflow.a11y.chromium.spec.ts`; `scripts/text-overflow-wrap-anywhere.test.mjs` | A long unbroken token, untruncated and single-line truncated, at 320 CSS px; Text inside CommandPaletteEmpty and Banner | A token that does not wrap in an untruncated heading, a page that scrolls sideways at 320 px, single-line truncation that no longer clips on one line, Text inside CommandPaletteEmpty or Banner that loses the container's `anywhere` wrap or crosses an inline edge, or a Core style that sets `overflow-wrap: anywhere` without passing it to Text, fails. | `audit:Heading/a11y` | -| FR4, PR1 | `Heading.test.tsx` truncation-measurement tests; `useTruncation.test.tsx`; `HeadingAudit.a11y.chromium.spec.ts` | Tooltip on and off; content change; one and two lines | Measuring with the tooltip off, not measuring with it on, or a missed re-measure fails. A one-line heading without its ellipsis, a two-line clamp that does not hold two lines, or a clipped heading whose hover shows no full-text tooltip fails the browser spec. Gap: the `wordBreak` defaults and the tooltip placement have no automated check. | `audit:Heading/behavior` | -| AR3 (tooltip mount), PR1 | `Heading.test.tsx` "the truncation tooltip mounts on the first interaction" case: no tooltip layer before any interaction, one on the first hover; the shared mount behavior is covered by the `Text.test.tsx` cases, since Text and Heading share `TruncationTooltip` | Truncated before and after the first hover, tap, or focus | A tooltip layer before the first interaction, a tooltip description at any time, or a first hover, tap or focus that does not open the Tooltip by its own rules, fails. Gap: no accessibility-tree check of the description (`spec:AST-009` FR3). | `audit:Heading/a11y` | -| FR5 | `Heading.test.tsx` ref, `id`, passthrough, `aria-level` precedence, styling-input, and line-clamp tests | Rerender; `id`; `data-testid`; caller `aria-level`; `className`, `xstyle`, and `style` | A detached ref, a lost `id` or test id, a derived `aria-level` that overrides the caller's, a `className` or `xstyle` that is dropped or merges before the component styles, or a caller `WebkitLineClamp` that replaces the clamp fails. | `audit:Heading/behavior` | -| AR1 | `Heading.test.tsx` display-type element tests | Levels with display and theme-added types | A visual type that changes the element fails. | `audit:Heading/a11y` | -| AR3 | `Heading.test.tsx` truncation title test; `HeadingAudit.a11y.chromium.spec.ts` | Truncated heading | A native `title` on a truncated heading fails both. | `audit:Heading/a11y` | -| AR1, AR2 | `HeadingAudit.a11y.chromium.spec.ts` reading Chromium's accessibility tree (`spec:AST-009` FR3) | Levels, equal and differing override, display types | A heading exposed with a role or level other than its element or `aria-level` requires fails the browser spec. | `audit:Heading/a11y` | +| Contract | Verification | Representative states | Mutation or failure expectation | Audit section | +| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ | +| FR1, AR2 | `Heading.test.tsx` level and `accessibilityLevel` tests | Levels 1–6; differing and equal override | A wrong element, a missing `aria-level` for a differing override, or an `aria-level` added for an equal one fails. | `audit:Heading/a11y` | +| FR2 | `Heading.test.tsx` target, type, theme-added type, weight, and omitted-type tests; `extensibleAxes.test.ts`; `HeadingAudit.a11y.chromium.spec.ts` on the AuditMatrix story | Display types, theme-added type, weight | A lost `heading` class or `data-level`, `data-color`, `data-type`, or `data-weight` reflection, a reflected omitted type, or a theme-added type losing its level baseline fails. Display sizes out of order, or an explicit `bold` no heavier than the display default, fails the browser spec. Gap: the level scales and the level default weights have no paint check. | `audit:Heading/theming` | +| FR3 | Stable visual baseline `core-heading--level-1`; `Heading.stories.tsx`; `HeadingAudit.a11y.chromium.spec.ts` | Level 1 default; secondary color; `center` and `end` alignment | A changed level-1 scale, color, or display comes back changed for review; a `justify` that does not resolve to logical `center` or `end`, or heading text below its WCAG contrast threshold, fails the browser spec. Gap: `display` precedence, `textWrap`, cap-height trim, strikethrough, and the theme-added color baseline have no automated check. | `audit:Heading/behavior` | +| FR3 (reflow) | `Heading.test.tsx` long unbroken tokens; `TextReflow.a11y.chromium.spec.ts`; `scripts/text-overflow-wrap-anywhere.test.mjs` | A long unbroken token, untruncated and single-line truncated, at 320 CSS px; Text inside CommandPaletteEmpty and Banner | A token that does not wrap in an untruncated heading, a page that scrolls sideways at 320 px, single-line truncation that no longer clips on one line, Text inside CommandPaletteEmpty or Banner that loses the container's `anywhere` wrap or crosses an inline edge, or a Core style that sets `overflow-wrap: anywhere` without passing it to Text, fails. | `audit:Heading/a11y` | +| FR4, PR1 | `Heading.test.tsx` truncation-measurement tests; `useTruncation.test.tsx`; `HeadingAudit.a11y.chromium.spec.ts` | Tooltip on and off; content change; one and two lines | Measuring with the tooltip off, not measuring with it on, or a missed re-measure fails. A one-line heading without its ellipsis, a two-line clamp that does not hold two lines, or a clipped heading whose hover shows no full-text tooltip fails the browser spec. The `Heading.test.tsx` long-token tests pin the one-line `wordBreak` default and the `break-all` opt-in. Gap: the multi-line `wordBreak` default and the tooltip placement have no automated check. | `audit:Heading/behavior` | +| AR3 (tooltip mount), PR1 | `Heading.test.tsx` "the truncation tooltip mounts on the first interaction" case: no tooltip layer before any interaction, one on the first hover; the shared mount behavior is covered by the `Text.test.tsx` cases, since Text and Heading share `TruncationTooltip` | Truncated before and after the first hover, tap, or focus | A tooltip layer before the first interaction, a tooltip description at any time, or a first hover, tap or focus that does not open the Tooltip by its own rules, fails. Gap: no accessibility-tree check of the description (`spec:AST-009` FR3). | `audit:Heading/a11y` | +| FR5 | `Heading.test.tsx` ref, `id`, passthrough, `aria-level` precedence, styling-input, and line-clamp tests | Rerender; `id`; `data-testid`; caller `aria-level`; `className`, `xstyle`, and `style` | A detached ref, a lost `id` or test id, a derived `aria-level` that overrides the caller's, a `className` or `xstyle` that is dropped or merges before the component styles, or a caller `WebkitLineClamp` that replaces the clamp fails. | `audit:Heading/behavior` | +| AR1 | `Heading.test.tsx` display-type element tests | Levels with display and theme-added types | A visual type that changes the element fails. | `audit:Heading/a11y` | +| AR3 | `Heading.test.tsx` truncation title test; `HeadingAudit.a11y.chromium.spec.ts` | Truncated heading | A native `title` on a truncated heading fails both. | `audit:Heading/a11y` | +| AR1, AR2 | `HeadingAudit.a11y.chromium.spec.ts` reading Chromium's accessibility tree (`spec:AST-009` FR3) | Levels, equal and differing override, display types | A heading exposed with a role or level other than its element or `aria-level` requires fails the browser spec. | `audit:Heading/a11y` | ## Decision log diff --git a/docs/specs/components/Text/Text.spec.md b/docs/specs/components/Text/Text.spec.md index 0f21edc93bc7e..b49478cac3673 100644 --- a/docs/specs/components/Text/Text.spec.md +++ b/docs/specs/components/Text/Text.spec.md @@ -35,15 +35,15 @@ system_specs: [spec:AST-009] ## Contract at a glance -| Area | Contract | -| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Public contract | A polymorphic text element with a semantic `type`, optional `size`, `color`, and `weight` overrides, an `as` element choice, and the text layout controls documented in `Text.doc.mjs`. | -| Behavior | `type` sets size, weight, and default color from the theme; theme-added types and colors fall back to the body and primary baselines; truncated text offers its full content in a Tooltip. | -| End-user impact | Readers get consistent type across the product; clamped text keeps its full content available on hover and in the DOM. | -| Builder impact | A long unbroken token in non-truncated Text wraps. Inside a flex row, the flex child needs `min-width: 0` for the wrap to apply, and a caller's own container that sets `overflow-wrap: anywhere` does not reach Text's text; Core's `anywhere` containers pass their wrap to it. The truncation Tooltip mounts on the first hover, completed tap or focus (AR2). | -| Compatibility/readiness | Released behavior recorded as current, with one styling output change and one DOM change: non-truncated Text sets `overflow-wrap` (`break-word`, or `anywhere` inside Core's `anywhere` containers). The truncation Tooltip mounts on the first hover, completed tap or focus, so until then a clamped Text has no tooltip layer, and it never adds `aria-describedby` (AR2). No API change. One implementation gap is listed under Current-state impact. | -| Review checks | Reject a theme-added type or color that renders unstyled, a native `title` beside the truncation Tooltip, or measurement when the tooltip is off. | -| Governing rules | `architecture:component-theming-surface/INV6,INV14`; `architecture:public-component-api/INV5,INV6,INV8`. | +| Area | Contract | +| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Public contract | A polymorphic text element with a semantic `type`, optional `size`, `color`, and `weight` overrides, an `as` element choice, and the text layout controls documented in `Text.doc.mjs`. | +| Behavior | `type` sets size, weight, and default color from the theme; theme-added types and colors fall back to the body and primary baselines; truncated text offers its full content in a Tooltip. | +| End-user impact | Readers get consistent type across the product; clamped text keeps its full content available on hover and in the DOM. | +| Builder impact | A long unbroken token in non-truncated Text wraps. Inside a flex row, the flex child needs `min-width: 0` for the wrap to apply, and a caller's own container that sets `overflow-wrap: anywhere` does not reach Text's text; Core's `anywhere` containers pass their wrap to it. The truncation Tooltip mounts on the first hover, completed tap or focus (AR2). | +| Compatibility/readiness | Released behavior recorded as current, with one styling output change and one DOM change: non-truncated Text sets `overflow-wrap` (`break-word`, or `anywhere` inside Core's `anywhere` containers). The truncation Tooltip mounts on the first hover, completed tap or focus, so until then a clamped Text has no tooltip layer, and it never adds `aria-describedby` (AR2). No prop change. One default change: with `maxLines={1}`, `wordBreak` defaults to `break-word` instead of `break-all` (FR4), a nonbreaking typography default; `wordBreak="break-all"` keeps the old split. One implementation gap is listed under Current-state impact. | +| Review checks | Reject a theme-added type or color that renders unstyled, a native `title` beside the truncation Tooltip, or measurement when the tooltip is off. | +| Governing rules | `architecture:component-theming-surface/INV6,INV14`; `architecture:public-component-api/INV5,INV6,INV8`. | This table is a review projection; the body below is authoritative. @@ -56,9 +56,12 @@ the truncation behavior of that element. Heading is documented beside Text in ## Compatibility and migration -- Released default preserved: `yes` -- Compatibility class: one styling output change and one DOM change, with - no public prop or default change: non-truncated Text sets `overflow-wrap` +- Released default preserved: `no`: with `maxLines={1}`, `wordBreak` defaults + to `break-word` instead of `break-all` (FR4) +- Compatibility class: one styling output change, one DOM change and one + nonbreaking typography default change, with no public prop change. With + `maxLines={1}`, `wordBreak` defaults to `break-word` instead of `break-all`, + and `wordBreak="break-all"` keeps the old split (FR4). Non-truncated Text sets `overflow-wrap` (`break-word`, or `anywhere` inside Core's `anywhere` containers), so a long unbroken token wraps (FR3). The truncation Tooltip mounts on the first hover, completed tap or focus (AR2): before that, a clamped Text has no closed @@ -124,7 +127,7 @@ Consumer migration instructions belong in consumer docs and release notes. | FR1 | Text renders one element chosen by `as` (default `span`) carrying the `text` target, which reflects `type`, `size`, and the resolved `color`. | Current source and tests | | FR2 | A built-in `type` applies its size, line height, and default weight; a theme-added type applies the body baseline. `size` overrides the type's size while keeping its other properties; `weight` overrides the type's default weight. The resolved color is `color`, else the type's default; a theme-added color applies the primary baseline. | Current source and tests | | FR3 | `hasCapsize` renders `block` and trims to cap height; otherwise `maxLines` above 1 renders the line-clamp box, `maxLines={1}` renders `block`, and otherwise `display` (default `inline`) applies. `justify` uses logical values; `start`, the default, sets no alignment, so the element follows its container's. `textWrap`, `hasStrikethrough`, and `hasTabularNumbers` apply their text treatments. Without truncation, a token longer than its line wraps, so in ordinary flow the text does not force horizontal scrolling at 320 CSS px (`spec:AST-020` FR1, WCAG 2.2 1.4.10 Reflow). The element's `overflow-wrap` is `break-word`, which keeps min-content, so tables and auto-sized columns lay out ordinary words unchanged; inside a Core container that wraps its content with `anywhere` (CommandPaletteEmpty, Toast, FieldStatus, Banner), it is `anywhere`, as the container's own text is. A flex child needs `min-width: 0` from its container, and a caller's own container that sets `overflow-wrap: anywhere` does not reach the element's text. | Current source and tests | -| FR4 | `maxLines={1}` clips one line with an ellipsis; a larger value clamps to that many lines unless `hasCapsize` is set, whose `block` display removes the clamp. With truncation, `wordBreak` defaults to `break-all` for one line and `break-word` otherwise. When the text is measured as truncated and `hasTruncateTooltip` is not `false`, a lazily loaded Tooltip anchored to the element shows the full text at the given placement (default `above`), and Text adds no native `title`. `hasTruncateTooltip={false}` takes no measurement. A truncation tooltip can be opened from the keyboard (WCAG 2.2 2.1.1). Implementation gap: the tooltip opens on hover and touch only, because the element is not focusable (Current-state impact). Truncation re-measures when the content changes without a resize. | Current source and tests | +| FR4 | `maxLines={1}` clips one line with an ellipsis; a larger value clamps to that many lines unless `hasCapsize` is set, whose `block` display removes the clamp. With truncation, `wordBreak` defaults to `break-word` for both one line and multiple lines; callers can pass `break-all` when splitting inside words is intentional. When the text is measured as truncated and `hasTruncateTooltip` is not `false`, a lazily loaded Tooltip anchored to the element shows the full text at the given placement (default `above`), and Text adds no native `title`. `hasTruncateTooltip={false}` takes no measurement. A truncation tooltip can be opened from the keyboard (WCAG 2.2 2.1.1). Implementation gap: the tooltip opens on hover and touch only, because the element is not focusable (Current-state impact). Truncation re-measures when the content changes without a resize. | Current source and tests | | FR5 | `ref` reaches the element. Supported DOM, ARIA, data, and event props reach it; `xstyle`, `className`, and `style` merge in that order after component styles, with the line clamp applied after `style`. | Current source and tests | ### Allowed variation @@ -208,15 +211,15 @@ record declares no anatomy-theming block rather than assign `heading` to Text. ## Verification map -| Contract | Verification | Representative states | Mutation or failure expectation | Audit section | -| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | -| FR1, AR1 | `Text.test.tsx` element, target, and reflection tests | Default `span`; `p`, `div`, `label` | A wrong element, a lost `text` class, or a lost `data-type`, `data-size`, or `data-color` reflection fails. Gap: no test asserts that Text adds no role, and no accessibility-tree check proves the element's role (`spec:AST-009` FR3). | `audit:Text/behavior` | -| FR2 | `Text.test.tsx` theme-added type and color tests; stable visual baseline `core-text--body` | Theme-added type and color; built-in color; body default | A theme-added type or color losing its reflection, a theme-added color losing its primary baseline, or a lost color override, fails; a changed body scale or color comes back changed for review. Gap: no test asserts a theme-added type's body baseline (the custom-type test checks only the class and `data-type`), and the built-in type tests assert presence only, so each type's size, line height, and weight, and the `size` and `weight` overrides in paint, have no automated check. Each type's default color and a built-in color's paint also have no automated check; the color tests assert `data-color` only. | `audit:Text/theming` | -| FR3 | `Text.stories.tsx` | Display, cap-height trim, wrap, strikethrough, tabular numbers | Gap: the prop tests assert presence only, so `display` precedence, `justify`, and every text treatment have no automated check. | `audit:Text/behavior` | -| FR3 (reflow) | `Text.test.tsx` long unbroken tokens; `TextReflow.a11y.chromium.spec.ts`; `scripts/text-overflow-wrap-anywhere.test.mjs` | A long unbroken token, inline and block, untruncated and single-line truncated, at 320 CSS px; Text inside CommandPaletteEmpty and Banner | A token that does not wrap in untruncated text, a page that scrolls sideways at 320 px, single-line truncation that no longer clips on one line, Text inside CommandPaletteEmpty or Banner that loses the container's `anywhere` wrap or crosses an inline edge, or a Core style that sets `overflow-wrap: anywhere` without passing it to Text, fails. | `audit:Text/a11y` | -| FR4, AR2, PR1 | `Text.test.tsx` native-title and truncation-measurement tests; `useTruncation.test.tsx` | Truncated with tooltip; tooltip off; content change | A native `title`, measuring with the tooltip off, not measuring with it on, or a missed re-measure fails. Gap: the ellipsis and line clamp, the `wordBreak` defaults, and the tooltip's appearance and placement have no automated check. Known limit: a multi-line clamp measures by line centres in an untransformed frame. Under a transform the check may keep the content-height answer (padding counts), except that a turn it cannot detect (an `offset-rotate`, or a turn inside a closed shadow root) still uses line centres and can hide the tooltip of clipped text; a 3D `translate` property is read as flat; and an ancestor scaled below 1 can hide the tooltip of text that only just overflows. A clamp box that an outside height cap makes shorter than its lines (such as a fixed-height flex column) can cut part of a line and still measure as not clipped, so it opens no tooltip. `TextTruncationPadding.a11y.browser.spec.ts` covers the fit and overflow stories. The Lab `LineClamp` and Lightbox's caption toggle measure through the same hook and have no test of their own here. | `audit:Text/a11y` | -| AR2 (tooltip mount), PR1 | `Text.test.tsx` "the truncation tooltip mounts on the first interaction" cases: no tooltip layer or description before any interaction; the first hover mounts it and opens it after the hover delay, and neither that hover nor a later keyboard focus adds a description; a pointer that leaves first opens nothing; the tap that mounts it opens it and a tap outside closes it; a touch that becomes a scroll mounts nothing; keyboard focus inside the clamped element mounts it; a tap on a focusable child that focuses it first still opens the Tooltip, a tap on a text field only focuses it, before and after the Tooltip mounts, and a keyboard Tab to a text field mounts it; a caller's `preventDefault` does not stop the mount. Real-browser mount count on the `ManyTruncatedRows` story (500 rows: no tooltip layers at load) | Truncated before and after the first hover, tap, or focus | A tooltip layer before the first interaction, a tooltip description at any time, or a first hover, tap or focus that does not open the Tooltip by its own rules, fails. Gap: no accessibility-tree check of the description (`spec:AST-009` FR3). | `audit:Text/a11y` | -| FR5 | `Text.test.tsx` ref and passthrough tests | Rerender; `data-testid` | A detached ref or a lost test id fails. Gap: no test covers other DOM passthrough, the styling-input merge order, or the line clamp after `style`. | `audit:Text/behavior` | +| Contract | Verification | Representative states | Mutation or failure expectation | Audit section | +| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | +| FR1, AR1 | `Text.test.tsx` element, target, and reflection tests | Default `span`; `p`, `div`, `label` | A wrong element, a lost `text` class, or a lost `data-type`, `data-size`, or `data-color` reflection fails. Gap: no test asserts that Text adds no role, and no accessibility-tree check proves the element's role (`spec:AST-009` FR3). | `audit:Text/behavior` | +| FR2 | `Text.test.tsx` theme-added type and color tests; stable visual baseline `core-text--body` | Theme-added type and color; built-in color; body default | A theme-added type or color losing its reflection, a theme-added color losing its primary baseline, or a lost color override, fails; a changed body scale or color comes back changed for review. Gap: no test asserts a theme-added type's body baseline (the custom-type test checks only the class and `data-type`), and the built-in type tests assert presence only, so each type's size, line height, and weight, and the `size` and `weight` overrides in paint, have no automated check. Each type's default color and a built-in color's paint also have no automated check; the color tests assert `data-color` only. | `audit:Text/theming` | +| FR3 | `Text.stories.tsx` | Display, cap-height trim, wrap, strikethrough, tabular numbers | Gap: the prop tests assert presence only, so `display` precedence, `justify`, and every text treatment have no automated check. | `audit:Text/behavior` | +| FR3 (reflow) | `Text.test.tsx` long unbroken tokens; `TextReflow.a11y.chromium.spec.ts`; `scripts/text-overflow-wrap-anywhere.test.mjs` | A long unbroken token, inline and block, untruncated and single-line truncated, at 320 CSS px; Text inside CommandPaletteEmpty and Banner | A token that does not wrap in untruncated text, a page that scrolls sideways at 320 px, single-line truncation that no longer clips on one line, Text inside CommandPaletteEmpty or Banner that loses the container's `anywhere` wrap or crosses an inline edge, or a Core style that sets `overflow-wrap: anywhere` without passing it to Text, fails. | `audit:Text/a11y` | +| FR4, AR2, PR1 | `Text.test.tsx` native-title and truncation-measurement tests; `useTruncation.test.tsx` | Truncated with tooltip; tooltip off; content change | A native `title`, measuring with the tooltip off, not measuring with it on, or a missed re-measure fails. The `Text.test.tsx` long-token tests pin the one-line `wordBreak` default and the `break-all` opt-in. Gap: the ellipsis and line clamp, the multi-line `wordBreak` default, and the tooltip's appearance and placement have no automated check. Known limit: a multi-line clamp measures by line centres in an untransformed frame. Under a transform the check may keep the content-height answer (padding counts), except that a turn it cannot detect (an `offset-rotate`, or a turn inside a closed shadow root) still uses line centres and can hide the tooltip of clipped text; a 3D `translate` property is read as flat; and an ancestor scaled below 1 can hide the tooltip of text that only just overflows. A clamp box that an outside height cap makes shorter than its lines (such as a fixed-height flex column) can cut part of a line and still measure as not clipped, so it opens no tooltip. `TextTruncationPadding.a11y.browser.spec.ts` covers the fit and overflow stories. The Lab `LineClamp` and Lightbox's caption toggle measure through the same hook and have no test of their own here. | `audit:Text/a11y` | +| AR2 (tooltip mount), PR1 | `Text.test.tsx` "the truncation tooltip mounts on the first interaction" cases: no tooltip layer or description before any interaction; the first hover mounts it and opens it after the hover delay, and neither that hover nor a later keyboard focus adds a description; a pointer that leaves first opens nothing; the tap that mounts it opens it and a tap outside closes it; a touch that becomes a scroll mounts nothing; keyboard focus inside the clamped element mounts it; a tap on a focusable child that focuses it first still opens the Tooltip, a tap on a text field only focuses it, before and after the Tooltip mounts, and a keyboard Tab to a text field mounts it; a caller's `preventDefault` does not stop the mount. Real-browser mount count on the `ManyTruncatedRows` story (500 rows: no tooltip layers at load) | Truncated before and after the first hover, tap, or focus | A tooltip layer before the first interaction, a tooltip description at any time, or a first hover, tap or focus that does not open the Tooltip by its own rules, fails. Gap: no accessibility-tree check of the description (`spec:AST-009` FR3). | `audit:Text/a11y` | +| FR5 | `Text.test.tsx` ref and passthrough tests | Rerender; `data-testid` | A detached ref or a lost test id fails. Gap: no test covers other DOM passthrough, the styling-input merge order, or the line clamp after `style`. | `audit:Text/behavior` | ## Decision log diff --git a/packages/cli/assets/templates/blocks/components/Text/TextWordBreak.doc.mjs b/packages/cli/assets/templates/blocks/components/Text/TextWordBreak.doc.mjs index 0761bf27aa70f..bea42b0b5038b 100644 --- a/packages/cli/assets/templates/blocks/components/Text/TextWordBreak.doc.mjs +++ b/packages/cli/assets/templates/blocks/components/Text/TextWordBreak.doc.mjs @@ -9,5 +9,5 @@ export const doc = { description: 'Compares break-word and break-all word break modes on a long unbreakable string.', isReady: true, aspectRatio: 16 / 9, - componentsUsed: ['Text'], + componentsUsed: ['Text', 'Card', 'Stack'], }; diff --git a/packages/cli/assets/templates/blocks/components/Text/TextWordBreak.tsx b/packages/cli/assets/templates/blocks/components/Text/TextWordBreak.tsx index 792ecfdbf9589..5794fdfb74cbc 100644 --- a/packages/cli/assets/templates/blocks/components/Text/TextWordBreak.tsx +++ b/packages/cli/assets/templates/blocks/components/Text/TextWordBreak.tsx @@ -2,47 +2,29 @@ 'use client'; +import {Card} from '@astryxdesign/core/Card'; +import {VStack} from '@astryxdesign/core/Stack'; import {Text} from '@astryxdesign/core/Text'; export default function TextWordBreak() { return ( -
-
- - Break-word (default for multi-line) - -
+ + + Break-word (default for all truncation) + This is a verylongunbreakableword for a break-word example -
-
-
- - Break-all (default for single-line) - -
+ + + + Break-all (explicit opt-in) + Breaks anywhere: abcdefghijklmnopqrstuvwxyz0123456789 -
-
-
+ + + ); } diff --git a/packages/core/src/Heading/Heading.test.tsx b/packages/core/src/Heading/Heading.test.tsx index 7675e55709ce7..986e5a881e511 100644 --- a/packages/core/src/Heading/Heading.test.tsx +++ b/packages/core/src/Heading/Heading.test.tsx @@ -322,7 +322,7 @@ describe('Heading long unbroken tokens', () => { expect(wrapOf(screen.getByText(token))).toBe(DEFAULT_WRAP); }); - it('leaves single-line truncation clipping on one line', () => { + it('keeps single-line truncation on one line by default', () => { render( {token} @@ -331,7 +331,33 @@ describe('Heading long unbroken tokens', () => { const style = getComputedStyle(screen.getByText(token)); expect(style.whiteSpace).toBe('nowrap'); expect(style.textOverflow).toBe('ellipsis'); - expect(style.overflowWrap).not.toBe('break-word'); + expect(style.wordBreak).toBe('normal'); + expect(style.overflowWrap).toBe('break-word'); + }); + + it('breaks between words when a caller allows the line to wrap', () => { + const sentence = + 'Understanding accessibility requirements for design systems'; + render( + + {sentence} + , + ); + const style = getComputedStyle(screen.getByText(sentence)); + expect(style.whiteSpace).toBe('normal'); + expect(style.wordBreak).toBe('normal'); + expect(style.overflowWrap).toBe('break-word'); + }); + + it('splits inside words when a caller passes wordBreak="break-all"', () => { + render( + + {token} + , + ); + expect(getComputedStyle(screen.getByText(token)).wordBreak).toBe( + 'break-all', + ); }); }); diff --git a/packages/core/src/Heading/Heading.tsx b/packages/core/src/Heading/Heading.tsx index 1e215006b67e3..e26fd4ae91e74 100644 --- a/packages/core/src/Heading/Heading.tsx +++ b/packages/core/src/Heading/Heading.tsx @@ -156,7 +156,7 @@ export interface HeadingProps extends Omit< /** * Word break behavior for truncated text. - * @default 'break-all' for maxLines=1, 'break-word' otherwise + * @default 'break-word' */ wordBreak?: WordBreak; @@ -267,9 +267,9 @@ export function Heading({ ? {'aria-level': accessibilityLevel} : {}; - // Resolve wordBreak with smart default - const resolvedWordBreak = - wordBreak ?? (maxLines === 1 ? 'break-all' : 'break-word'); + // A single-line clamp does not wrap. If a caller restores wrapping, + // lines break where a multi-line clamp breaks them. + const resolvedWordBreak = wordBreak ?? 'break-word'; // Resolve display - force block when maxLines > 0 or hasCapsize const resolvedDisplay = maxLines > 0 || hasCapsize ? 'block' : display; diff --git a/packages/core/src/Text/Heading.doc.mjs b/packages/core/src/Text/Heading.doc.mjs index 0817b7811b1a9..8a9a9e9496139 100644 --- a/packages/core/src/Text/Heading.doc.mjs +++ b/packages/core/src/Text/Heading.doc.mjs @@ -82,7 +82,7 @@ export const docs = { name: 'wordBreak', type: "'break-word' | 'break-all'", description: - "Word break behavior when truncating. Defaults to 'break-all' for single-line truncation, 'break-word' otherwise. Without truncation, a token longer than its line (a URL, an ID) wraps (`overflow-wrap: break-word`), so in ordinary flow text does not make the page scroll sideways. Inside a flex row, give the flex child `min-width: 0` so it can shrink. A container you style with `overflow-wrap: anywhere` does not reach this text; Astryx's own containers pass their wrap through.", + "Word break behavior when truncating. Defaults to 'break-word' for both single-line and multi-line truncation; pass 'break-all' when splitting inside words is intentional. Without truncation, a token longer than its line (a URL, an ID) wraps (`overflow-wrap: break-word`), so in ordinary flow text does not make the page scroll sideways. Inside a flex row, give the flex child `min-width: 0` so it can shrink. A container you style with `overflow-wrap: anywhere` does not reach this text; Astryx's own containers pass their wrap through.", }, { name: 'textWrap', @@ -206,7 +206,7 @@ export const docsZh = { name: 'wordBreak', type: "'break-word' | 'break-all'", description: - "截断时的断词行为。单行截断默认为 'break-all',其他情况默认为 'break-word'。不截断时,超过一行宽度的长串(如 URL、ID)会换行(`overflow-wrap: break-word`),因此在普通文档流中文本不会让页面横向滚动。在 flex 行中,请为 flex 子元素设置 `min-width: 0` 以便其收缩。你自己设置了 `overflow-wrap: anywhere` 的容器不会作用于此文本;Astryx 自带的容器会传递其换行方式。", + "截断时的断词行为。单行和多行截断都默认为 'break-word';如果确实要在单词内部断开,请传入 'break-all'。不截断时,超过一行宽度的长串(如 URL、ID)会换行(`overflow-wrap: break-word`),因此在普通文档流中文本不会让页面横向滚动。在 flex 行中,请为 flex 子元素设置 `min-width: 0` 以便其收缩。你自己设置了 `overflow-wrap: anywhere` 的容器不会作用于此文本;Astryx 自带的容器会传递其换行方式。", }, { name: 'textWrap', @@ -284,7 +284,7 @@ export const docsDense = { hasTruncateTooltip: "Tooltip for truncated text; true=default position, false=disabled, or a placement ('above' | 'below' | 'start' | 'end').", wordBreak: - "Word break behavior when truncating; defaults 'break-all' for single-line, 'break-word' otherwise. Untruncated long tokens wrap (overflow-wrap: break-word); a flex child needs min-width: 0; your own container's overflow-wrap: anywhere does not reach this text (Astryx containers pass theirs through).", + "Word break behavior when truncating; defaults 'break-word' for both single-line and multi-line truncation. Pass 'break-all' when splitting inside words is intentional. Untruncated long tokens wrap (overflow-wrap: break-word); a flex child needs min-width: 0; your own container's overflow-wrap: anywhere does not reach this text (Astryx containers pass theirs through).", textWrap: 'Text wrapping behavior.', justify: "Text alignment (justification); logical values 'start' | 'center' | 'end' for RTL.", diff --git a/packages/core/src/Text/Text.doc.mjs b/packages/core/src/Text/Text.doc.mjs index 10ee7d1d6cc51..ddfb868bbbde9 100644 --- a/packages/core/src/Text/Text.doc.mjs +++ b/packages/core/src/Text/Text.doc.mjs @@ -118,7 +118,7 @@ export const docs = { name: 'wordBreak', type: "'break-word' | 'break-all'", description: - "Word break behavior when truncating. Defaults to 'break-all' for single-line truncation, 'break-word' otherwise. Without truncation, a token longer than its line (a URL, an ID) wraps (`overflow-wrap: break-word`), so in ordinary flow text does not make the page scroll sideways. Inside a flex row, give the flex child `min-width: 0` so it can shrink. A container you style with `overflow-wrap: anywhere` does not reach this text; Astryx's own containers pass their wrap through.", + "Word break behavior when truncating. Defaults to 'break-word' for both single-line and multi-line truncation; pass 'break-all' when splitting inside words is intentional. Without truncation, a token longer than its line (a URL, an ID) wraps (`overflow-wrap: break-word`), so in ordinary flow text does not make the page scroll sideways. Inside a flex row, give the flex child `min-width: 0` so it can shrink. A container you style with `overflow-wrap: anywhere` does not reach this text; Astryx's own containers pass their wrap through.", }, { name: 'textWrap', diff --git a/packages/core/src/Text/Text.test.tsx b/packages/core/src/Text/Text.test.tsx index 39507cc973b03..6752311d55e91 100644 --- a/packages/core/src/Text/Text.test.tsx +++ b/packages/core/src/Text/Text.test.tsx @@ -251,13 +251,38 @@ describe('Text', () => { expect(wrapOf(screen.getByText(`${token}/block`))).toBe(DEFAULT_WRAP); }); - it('leaves single-line truncation clipping on one line', () => { + it('keeps single-line truncation on one line by default', () => { render({token}); const style = getComputedStyle(screen.getByText(token)); expect(style.whiteSpace).toBe('nowrap'); expect(style.textOverflow).toBe('ellipsis'); - expect(style.wordBreak).toBe('break-all'); - expect(style.overflowWrap).not.toBe('break-word'); + expect(style.wordBreak).toBe('normal'); + expect(style.overflowWrap).toBe('break-word'); + }); + + it('breaks between words when a caller allows the line to wrap', () => { + const sentence = + 'Quarterly reliability review notes for the platform team'; + render( + + {sentence} + , + ); + const style = getComputedStyle(screen.getByText(sentence)); + expect(style.whiteSpace).toBe('normal'); + expect(style.wordBreak).toBe('normal'); + expect(style.overflowWrap).toBe('break-word'); + }); + + it('splits inside words when a caller passes wordBreak="break-all"', () => { + render( + + {token} + , + ); + expect(getComputedStyle(screen.getByText(token)).wordBreak).toBe( + 'break-all', + ); }); }); diff --git a/packages/core/src/Text/Text.tsx b/packages/core/src/Text/Text.tsx index da954186ff862..c242a939e1b44 100644 --- a/packages/core/src/Text/Text.tsx +++ b/packages/core/src/Text/Text.tsx @@ -119,7 +119,7 @@ export interface TextProps extends Omit { /** * Word break behavior for truncated text. - * @default 'break-all' for maxLines=1, 'break-word' otherwise + * @default 'break-word' */ wordBreak?: WordBreak; @@ -258,9 +258,9 @@ export function Text({ // class (see themeProps below). const styleColor = resolveStyleColor(resolvedColor); - // Resolve wordBreak with smart default - const resolvedWordBreak = - wordBreak ?? (maxLines === 1 ? 'break-all' : 'break-word'); + // A single-line clamp does not wrap. If a caller restores wrapping, + // lines break where a multi-line clamp breaks them. + const resolvedWordBreak = wordBreak ?? 'break-word'; // Resolve display - force block when maxLines > 0 or hasCapsize const resolvedDisplay = maxLines > 0 || hasCapsize ? 'block' : display; diff --git a/packages/core/src/Text/__tests__/TextReflow.a11y.chromium.spec.ts b/packages/core/src/Text/__tests__/TextReflow.a11y.chromium.spec.ts index f1387200ee941..081319b58b464 100644 --- a/packages/core/src/Text/__tests__/TextReflow.a11y.chromium.spec.ts +++ b/packages/core/src/Text/__tests__/TextReflow.a11y.chromium.spec.ts @@ -114,9 +114,16 @@ test('single-line truncation still clips the token on one line at 320 px', async return { whiteSpace: computed.whiteSpace, textOverflow: computed.textOverflow, + wordBreak: computed.wordBreak, + overflowWrap: computed.overflowWrap, }; }); - expect(style, id).toEqual({whiteSpace: 'nowrap', textOverflow: 'ellipsis'}); + expect(style, id).toEqual({ + whiteSpace: 'nowrap', + textOverflow: 'ellipsis', + wordBreak: 'normal', + overflowWrap: 'break-word', + }); expect(await lineCount(target), id).toBe(1); expect( await target.evaluate(