Skip to content

Give the product name its own line in the shelf list (#31) - #34

Merged
spdotdev merged 1 commit into
mainfrom
fix/31-product-name-truncated
Jul 12, 2026
Merged

spdotdev merged 1 commit into
mainfrom
fix/31-product-name-truncated

Conversation

@spdotdev

Copy link
Copy Markdown
Owner

Fixes #31

Root cause

The product name and every control lived in one Row. The two stepper buttons (Material's 58dp min-width each) and the move TextButton are measured at their intrinsic width first, so Modifier.weight(1f) on the name only ever got the leftover. Measured on a Pixel 7 Pro, in English: the name got 103dp of a 452dp card — 23%. In Dutch it's worse, because "Verplaatsen" is seven characters longer than "Move", which is why the reporter saw names cut to Ch at… / Ge h….

The existing maxLines = 2 + ellipsis had hidden the one-char-per-line squash from an earlier report, but it never gave the name any width back — it just changed how the squash looked.

Fix

Stack the card: the name gets its own full-width line, with the stepper and move button beneath it. The name's width no longer depends on how long the current locale's move label is — the coupling is gone structurally, not tuned around.

The action row is a FlowRow so the move button wraps to its own line instead of being clipped off the card at large accessibility font scales.

FlowTestBase.clickNameArea is retargeted at the top of the card: the name moved from the left column to the top line, so a 50%-height tap now lands on the stepper — the disabled-−-swallows-the-click trap that helper was written for.

Tests

ProductNameLayoutFlowTest covers both halves, and both assertions fail on main:

  • the name gets ≥80% of the card width (locale- and font-scale-independent — the invariant that actually broke)
  • a normal name (Chateaubriand) lays out on one unellipsized line, which is what the reporter asked for

Verification

Drove the real app on a Pixel 7 Pro against a mocked backend, with the reporter's own product names:

  • English — every name on one line, incl. Chateaubriand, Runderrookvlees
  • Dutch — same, with Verplaatsen fully visible
  • Dutch @ 1.6× font scale — names still one line, move button still fully visible, nothing clipped

Full suite green: 39/39 instrumented, 124/124 unit, ktlint + detekt clean.

The name shared one Row with the quantity stepper and the move button, so
it was only ever allotted the width those controls left behind — 103dp of a
452dp card on a Pixel 7 Pro. In Dutch it was worse still: "Verplaatsen" is
seven characters longer than "Move", squashing names down to two or three
characters. maxLines=2 + ellipsis had hidden the one-char-per-line squash
without giving the name any width back.

Stack the card instead: name on its own full-width line, stepper and move
button beneath it. The name's width no longer depends on how long the
current locale's move label happens to be. The action row is a FlowRow so
the move button wraps rather than clipping at large font scales.

Also retarget FlowTestBase.clickNameArea at the card's top: the name moved
from the left column to the top line, so a 50%-height tap now lands on the
stepper — the disabled-"−"-swallows-the-click trap that helper exists for.
@spdotdev spdotdev self-assigned this Jul 12, 2026
@spdotdev spdotdev added the bug Something isn't working label Jul 12, 2026
@spdotdev
spdotdev merged commit 3df86f8 into main Jul 12, 2026
2 checks passed
@spdotdev
spdotdev deleted the fix/31-product-name-truncated branch July 12, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] The text is not visible correctly

1 participant