admin: Fix selected value rendering underneath the end adornment in SelectField#6013
Draft
vps-manuel-blum wants to merge 1 commit into
Draft
admin: Fix selected value rendering underneath the end adornment in SelectField#6013vps-manuel-blum wants to merge 1 commit into
vps-manuel-blum wants to merge 1 commit into
Conversation
…electField The select reserved a fixed amount of space for the absolutely positioned end adornment, which was too small when more than the clear button was rendered (e.g. an error icon), so long values rendered underneath the icons. Reserve the measured distance between the input's right edge and the adornment's left edge instead, so the value text is always truncated before the first adornment icon, regardless of which adornments are visible. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017r3LhoQaLGMzEs52Dg4SnZ
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.
Problem
SelectField/FinalFormSelecthas the same class of problem as the multi-selectAutocompleteFieldin #5434, in a milder form: the end adornment doesn't wrap (the theme already positions it absolutely), but the select reserves a fixedpadding-right(42px via theinputAdornedEndtheme override) while the adornment width varies at runtime. As a result, long values render underneath the icons:SelectFieldchildren path (optionsprop), the text paints 6px under the clear buttonSolution
Same approach as #5434: the adornment container's position is measured (
ResizeObserver) and the distance between the input's right edge and the adornment's left edge is reserved aspadding-righton the select display, so the value text is always truncated (ellipsis) before the first adornment icon — regardless of which adornments (clear button, error icon) are currently visible.Both render paths (
children/optionsprop andoptions+getOptionLabel) now build the end adornment the same way. When no adornment is rendered, no padding is overridden and the theme default applies.Example
New regression story
components/form/SelectField/MultipleEndAdornmentwith 10 cases (long value, many values, required, empty, disabled, error + clear, single-select, children path) and a container-width control to test any width — same setup as the story in #5434, so it can be tested on the deploy preview.Open TODOs/questions
renderValuefor multiple selects returns an array of labels, which React renders without separators ("ChocolateStrawberryVanilla"). Should be joined with ", " in a follow-up PR.Further information
AutocompleteField). Once both are merged, the measurement logic could be extracted into a shared internal hook in a follow-up.Generated by Claude Code