Skip to content

Commit 652e7ff

Browse files
authored
Fix TextInput, TextArea, and Select width bug (#828)
* fix bug where TextInput width would expand to length of validation message * remove duplicated styles * fixed same bug in TextArea * remove redundant style * fix width bug * remove unnecessary width * add changeset
1 parent 8c3448d commit 652e7ff

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

.changeset/sour-numbers-pretend.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react-brand': patch
3+
---
4+
5+
Fixed bug where `TextInput`, `TextArea`, and `Select` components would expand to the width of a the validation message on the parent `FormControl`.

packages/react/src/forms/Select/Select.module.css

+1-9
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,6 @@
8383
padding-block: 0;
8484
}
8585

86-
/*
87-
* Visual states
88-
*/
89-
90-
.Select--fullWidth {
91-
width: 100%;
92-
}
93-
9486
/*
9587
* Select wrapper
9688
*/
@@ -128,7 +120,7 @@
128120
}
129121

130122
.Select-wrapper--fullWidth {
131-
display: flex;
123+
width: 100%;
132124
}
133125

134126
/*

packages/react/src/forms/Select/Select.module.css.d.ts

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ declare const styles: {
66
readonly "Select--medium": string;
77
readonly "Select-wrapper--large": string;
88
readonly "Select--large": string;
9-
readonly "Select--fullWidth": string;
109
readonly "Select-wrapper--fullWidth": string;
1110
readonly "Select--success": string;
1211
readonly "Select--error": string;

packages/react/src/forms/TextInput/TextInput.module.css

+5
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,14 @@
8383
}
8484

8585
.TextInput-wrapper--fullWidth {
86+
width: 100%;
8687
display: flex;
8788
}
8889

90+
.TextInput-wrapper:not(.TextInput-wrapper--fullWidth) {
91+
width: min-content;
92+
}
93+
8994
.TextInput-wrapper--monospace {
9095
font-family: var(--brand-fontStack-monospace);
9196
}

packages/react/src/forms/Textarea/Textarea.module.css

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@
3030
outline: none;
3131
}
3232

33-
.Textarea:focus {
34-
outline: none;
35-
}
36-
3733
.Textarea-resize--vertical {
3834
resize: vertical;
3935
}
@@ -98,6 +94,10 @@
9894
display: flex;
9995
}
10096

97+
.Textarea-wrapper:not(.Textarea-wrapper--fullWidth) {
98+
width: min-content;
99+
}
100+
101101
.Textarea-wrapper--monospace {
102102
font-family: var(--brand-fontStack-monospace);
103103
}

0 commit comments

Comments
 (0)