Skip to content

Commit af3f5c4

Browse files
devongovettGitHub Enterprise
authored andcommitted
Fix field width with long labels (#189)
1 parent 8409541 commit af3f5c4

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

packages/@react-spectrum/s2/src/Field.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ function FieldLabel(props: FieldLabelProps, ref: DOMRef<HTMLLabelElement>) {
7676
labelPosition: {
7777
top: '--field-gap'
7878
}
79+
},
80+
contain: {
81+
labelPosition: {
82+
top: 'inline-size'
83+
}
7984
}
8085
})({labelAlign, labelPosition})}>
8186
<Label

packages/@react-spectrum/s2/src/Slider.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@ const labelContainer = style({
9797
width: 'full',
9898
gridTemplateAreas: {
9999
labelPosition: {
100-
top: ['label . output']
100+
top: ['label output']
101101
}
102102
},
103103
gridTemplateColumns: {
104104
labelPosition: {
105105
top: [
106-
'auto 1fr auto'
106+
'1fr auto'
107107
]
108108
}
109109
},

packages/@react-spectrum/s2/src/style-utils.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ export const field = () => ({
3333
isInForm: 1
3434
},
3535
gridColumnEnd: {
36-
isInForm: 'span 2'
36+
isInForm: {
37+
labelPosition: {
38+
side: 'span 2'
39+
}
40+
}
3741
},
3842
gridTemplateColumns: {
3943
default: {
@@ -100,11 +104,6 @@ export const fieldLabel = () => ({
100104
}
101105
},
102106
forcedColors: 'ButtonText'
103-
},
104-
contain: {
105-
labelPosition: {
106-
top: 'inline-size'
107-
}
108107
}
109108
} as const);
110109

0 commit comments

Comments
 (0)