Repository navigation
[6.x] Keep the asset picker on one row in narrow fields - #16175
Merged
Merged
Conversation
- Narrow fields say "or upload" next to Browse, without wrapping - Centre the file count badge on the row
- Below 30rem the short layout stays on one line; above it the text wraps beside Browse Assets as before - 30rem fits the longest translation (French) without the row wrapping - Keep the full stop with the upload link - Centre the file count badge only when the rename folder menu is there
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.
Description of the Problem
In a narrow Assets field (a single-file field on a phone, or in a half-width column), the picker squeezes "or choose a file" into a sliver beside the Browse button, so it breaks across three lines. The link is a button, so its text is centred too, which makes it look scattered. When the field has a dynamic folder, the "…" menu sits in the same row and makes it tighter still.
A bit wider, the full stop after "choose a file" could also wrap onto a line of its own.
What this PR Does
Why 31rem rather than 24rem
The switch used to be at 24rem, but the full layout still wrapped above that once the badge and the "…" were both there. I checked the language files and French has the longest "Browse Assets" ("Parcourir les ressources"). With the badge and "…" showing, the French row needs just over 30rem, so 31rem keeps it on one row in every language.
I did try measuring the row with a ResizeObserver and switching only when it actually wraps. It worked, but it was a lot more code for a few pixels of difference, so a fixed container query felt like the better trade.
Before / After
How to Reproduce
max_files: 1and a dynamic folder (e.g.dynamic: slug), so the badge and the "…" menu both show