Skip to content

Commit 26fc8f5

Browse files
reidbarbersnowystingerLFDanLu
authored
Fix TextArea not using full height when custom height provided (#3720)
* fix textarea not using full fixed height * add chromatic story * handle quiet case Co-authored-by: Robert Snow <[email protected]> Co-authored-by: Daniel Lu <[email protected]>
1 parent 8d65c99 commit 26fc8f5

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

packages/@adobe/spectrum-css-temp/components/fieldlabel/index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ governing permissions and limitations under the License.
7171
"field field field"
7272
"helpText helpText helpText";
7373
grid-template-columns: auto auto minmax(0, 1fr);
74+
grid-template-rows: auto 1fr auto;
7475
align-content: start;
7576
width: var(--spectrum-field-default-width);
7677

packages/@adobe/spectrum-css-temp/components/textfield/index.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ governing permissions and limitations under the License.
188188
}
189189
}
190190

191+
.spectrum-Textfield-wrapper.spectrum-Textfield-wrapper--quiet{
192+
grid-template-rows: auto;
193+
}
194+
191195
.spectrum-Textfield-wrapper .spectrum-Textfield--multiline {
192196
/* when textarea is inside a label wrapper, make it flex to take up remaining height. */
193197
flex: 1 1 auto;

packages/@react-spectrum/textfield/chromatic/TextArea.chromatic.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ storiesOf('TextArea', module)
8282
.add('custom width',
8383
() => render({icon: <Info />, validationState: 'invalid', width: 275})
8484
)
85+
.add('custom height',
86+
() => render({icon: <Info />, validationState: 'invalid', height: 350})
87+
)
8588
.add(
8689
'value: 測試, icon: Info, labelPosition: side, validationState: valid',
8790
() => render({value: '測試', icon: <Info />, labelPosition: 'side', validationState: 'valid'})

packages/@react-spectrum/textfield/src/TextFieldBase.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,15 @@ function TextFieldBase(props: TextFieldBaseProps, ref: Ref<TextFieldRef>) {
143143
labelProps={labelProps}
144144
descriptionProps={descriptionProps}
145145
errorMessageProps={errorMessageProps}
146-
wrapperClassName={classNames(styles, 'spectrum-Textfield-wrapper')}
146+
wrapperClassName={
147+
classNames(
148+
styles,
149+
'spectrum-Textfield-wrapper',
150+
{
151+
'spectrum-Textfield-wrapper--quiet': isQuiet
152+
}
153+
)
154+
}
147155
showErrorIcon={false}
148156
ref={domRef}>
149157
{textField}

0 commit comments

Comments
 (0)