Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/ui/src/Field.recipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ export const field = defineSlotRecipe({
// their own line below the label/control pair.
flexWrap: "wrap",
},
label: { mb: "0", flex: "1 1 auto" },
// Basis 0, not auto: the wrap container breaks lines on hypothetical
// sizes, and an auto basis is the label's max-content — a long
// translated label would push the control onto its own line instead
// of wrapping its text beside it.
label: { mb: "0", flex: "1 1 0" },
helperText: { width: "100%" },
errorMessage: { width: "100%" },
},
Expand Down
10 changes: 10 additions & 0 deletions packages/ui/stories/FieldChrome.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,16 @@ export const SideLabels: Story = {
>
{options}
</Select>
{/* Translation-length label: must wrap beside the control, not push
it onto its own line (the label's flex basis is 0 for this). */}
<Select
label="Highlight code structure when the translation runs long"
labelPosition="side"
defaultSelectedKey="Apple"
triggerCss={{ width: "28ch" }}
>
{options}
</Select>
<ComboBox
label="Preferred fruit"
labelPosition="side"
Expand Down