Skip to content

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

Merged
spdotdev merged 1 commit into
mainfrom
fix/sort-label-truncated
Jul 12, 2026
Merged

spdotdev merged 1 commit into
mainfrom
fix/sort-label-truncated

Conversation

@spdotdev

Copy link
Copy Markdown
Owner

Supersedes #35, which GitHub auto-closed when its base branch (fix/31-product-name-truncated) was deleted on merge of #34. Same commit, rebased onto main.

Found while verifying #31 on-device. Not a reported bug — no tester has filed it — so this PR doesn't close an issue. Say the word if you'd like it tracked as one.

The bug

The "Sort: Name A–Z" label in the Storage filter bar is ellipsized to Sort: Name…. 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 appears 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 pre-fix layout 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 while verifying #31: scrolled to rest, the FABs sit in empty space — the 150dp bottom spacer already clears them. What I saw was 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 merged commit e1d6406 into main Jul 12, 2026
2 checks passed
@spdotdev
spdotdev deleted the fix/sort-label-truncated branch July 12, 2026 18:18
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.

1 participant