Skip to content

Let the filter/sort row wrap instead of starving the sort label - #35

Closed
spdotdev wants to merge 1 commit into
fix/31-product-name-truncatedfrom
fix/sort-label-truncated
Closed

spdotdev wants to merge 1 commit into
fix/31-product-name-truncatedfrom
fix/sort-label-truncated

Conversation

@spdotdev

Copy link
Copy Markdown
Owner

Found while verifying #31 on-device. Not a reported bug — no tester has filed it — so this PR doesn't close an issue. Happy to file one if you'd rather track it that way; I didn't open one on my own.

Stacked on #34 (fix/31-product-name-truncated) because it needs the FlowRow import that PR adds. GitHub will retarget this to main once #34 merges.

The bug

The "Sort: Name A–Z" label in the Storage filter bar is ellipsized to Sort: Name…. Measured on a 360dp-wide phone it loses 4 characters at the default font size, and 14 characters at a 1.6× accessibility font scale, where it degrades to roughly ….

It hid on the reporter's phone because a Pixel 7 Pro is 412dp — just wide enough at the default font size. Raise the font scale or switch to Dutch ("Sorteren: Naam A–Z") and it shows up there too. Any 360dp device (Pixel 4a/5 and most mid-range phones) is showing it right now, at default settings.

Root cause

Exactly #31's, one row up: the two filter chips are sized to their content and are measured first, so SortMenu — the only flexible item in the Row — gets the leftover width and ellipsizes into it.

Fix

FlowRow instead of Row: every item keeps its intrinsic width and the row wraps, so the sort menu drops to its own line rather than being squeezed.

Tests

ProductFilterSortRowTest renders the row in isolation at a forced font scale on a 360dp width, and asserts no character of the label is lost to ellipsis. It fails on the current code at both 1.0 (4 chars) and 1.6 (14 chars), and passes here.

Two notes on how it's written:

  • The row is extracted into ProductFilterSortRow so it can be rendered at a font scale the flow tests can't reach — they run at whatever the device is set to.
  • hasVisualOverflow is not the oracle. It reports true even when the text got the width it asked for (301.5px wanted, 302px granted), so it fails a perfectly readable label. The test asserts on visible characters instead.

Verification

Drove the app on a Pixel 7 Pro, Dutch at 1.6× font scale: Sorteren: Naam A–Z now reads in full, wrapped to its own line under the chips. Full suite green: 42/42 instrumented, 124/124 unit, ktlint + detekt clean.

Also checked, not a bug

The FABs overlapping the last card, which I flagged earlier: scrolled to rest, the FABs sit in empty space — the 150dp bottom spacer already clears them. What I saw was just content passing under a floating button mid-scroll, which is what FABs do. No change made.

The two filter chips are sized to their content and are measured first, so
the sort label — the only flexible item in the Row — got only the leftover
width and ellipsized into it. At 360dp it loses 4 characters at the default
font size; at a 1.6x font scale it loses 14. A 412dp phone has just enough
room at default settings, which is why this hid until the font scale went up
or the app was switched to Dutch.

Same root cause as #31, one row up: fixed-size, content-sized controls
sharing a Row with the one thing that has to stay readable.

Make it a FlowRow so every item keeps its width and the row wraps instead.
The sort menu drops to its own line when the chips fill the first one.

ProductFilterSortRow is extracted so it can be rendered on its own at a
forced font scale — the flow tests run at the device's scale and cannot
reach the case that breaks. hasVisualOverflow turned out to be unusable as
the oracle (it reports true even when the text got the width it asked for:
301.5px wanted, 302px granted), so the test asserts on visible characters.
@spdotdev spdotdev self-assigned this Jul 12, 2026
@spdotdev spdotdev added the bug Something isn't working label Jul 12, 2026
@spdotdev
spdotdev deleted the branch fix/31-product-name-truncated July 12, 2026 18:13
@spdotdev spdotdev closed this Jul 12, 2026
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.

1 participant