Skip to content

fix(email-viewer): stop shattering table cells with word-break: break-word#342

Open
shukiv wants to merge 1 commit into
bulwarkmail:mainfrom
shukiv:fix/email-table-word-break-shatter
Open

fix(email-viewer): stop shattering table cells with word-break: break-word#342
shukiv wants to merge 1 commit into
bulwarkmail:mainfrom
shukiv:fix/email-table-word-break-shatter

Conversation

@shukiv
Copy link
Copy Markdown
Contributor

@shukiv shukiv commented May 26, 2026

Issue

Closes #341.

What changed

components/email/email-viewer.tsx:

```diff

  • td, th { word-break: break-word; }
  • td, th { overflow-wrap: anywhere; }
    ```

Why

`word-break: break-word` is a non-standard alias that some engines treat as `break-all` — it breaks ordinary words at arbitrary character boundaries, even when the word would fit if the column auto-expanded. The result for HTML-email tables with short Hebrew/Arabic/CJK headers (or long English strings) is column content collapsing to one glyph per row.

`overflow-wrap: anywhere` is the spec-blessed equivalent of "break long words ONLY when they would otherwise overflow", and it also relaxes the cell's min-content width so RTL tables no longer force horizontal scroll.

The rest of the iframe CSS already sets `overflow-wrap: break-word` on `body` and the table, so swapping the td/th rule keeps the same overflow semantics without re-introducing break-all behaviour.

Test plan

  • Hebrew/RTL transactional email — column headers now render single-line.
  • English email with long unbroken strings (e.g. raw URLs in a table cell) — still wraps correctly.
  • Mixed-language tables — no regressions observed.

…-word

The global rule

    td, th { word-break: break-word; }

was breaking HTML-email tables one glyph per row whenever a column was
narrow, especially for Hebrew/Arabic/CJK headers and long English
strings. The non-standard `word-break: break-word` keyword behaves
like `break-all` in some engines, splitting words at arbitrary
character boundaries even when the word would fit if the column auto-
expanded.

`overflow-wrap: break-word` is already set on body/table, so the rule
only needs to add min-content relaxation for cells. `overflow-wrap:
anywhere` does exactly that without re-introducing break-all
behaviour.

Repro: any transactional Hebrew/RTL order-summary email — each header
(`מוצר`, `כמות`, `מחיר`) collapses to one glyph per row. After the fix
they render on a single line.

Closes bulwarkmail#341.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Email body: td, th { word-break: break-word } shatters table content into one character per row in CJK/RTL/long-string columns

1 participant