Repository navigation
Let the filter/sort row wrap instead of starving the sort label - #36
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #35, which GitHub auto-closed when its base branch (
fix/31-product-name-truncated) was deleted on merge of #34. Same commit, rebased ontomain.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 theRow— gets the leftover width and ellipsizes into it.Fix
FlowRowinstead ofRow: every item keeps its intrinsic width and the row wraps, so the sort menu drops to its own line rather than being squeezed.Tests
ProductFilterSortRowTestrenders 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:
ProductFilterSortRowso it can be rendered at a font scale the flow tests can't reach — they run at whatever the device is set to.hasVisualOverflowis not the oracle. It reportstrueeven 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–Znow 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.