Skip to content

Commit c11afb2

Browse files
freddiejbawdenFreddie BawdensnowystingerLFDanLu
authored
fix: long picker options truncated in quiet mode (#5813)
* truncate overflowing text in quiet pickers that are in a fixed width container * add story to demonstrate quiet picker in fixed width container Co-authored-by: Freddie Bawden <[email protected]> Co-authored-by: Robert Snow <[email protected]> Co-authored-by: Daniel Lu <[email protected]>
1 parent c166369 commit c11afb2

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,16 @@ governing permissions and limitations under the License.
159159
.spectrum-Field.spectrum-Dropdown-fieldWrapper--quiet {
160160
display: inline-flex;
161161
flex-direction: column;
162-
inline-size: auto;
162+
inline-size: 100%;
163+
max-width: max-content;
163164

164165
.spectrum-Dropdown--quiet {
165166
inline-size: auto;
166167
min-inline-size: var(--spectrum-dropdown-quiet-min-width);
167168

168169
.spectrum-Dropdown-trigger {
169-
inline-size: auto;
170+
inline-size: 100%;
171+
max-width: max-content;
170172
}
171173
}
172174

packages/@react-spectrum/picker/stories/Picker.stories.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,36 @@ export const Quiet: PickerStory = {
415415
<Item key="always">Always</Item>
416416
</Picker>
417417
</View>
418+
<hr />
419+
<View
420+
width={200}>
421+
<h4>Quiet picker with label and fixed width (200px)</h4>
422+
<Picker
423+
isQuiet
424+
label="Choose frequency"
425+
defaultSelectedKey="sometimes">
426+
<Item key="rarely">Rarely</Item>
427+
<Item key="sometimes">
428+
This text is very long and will overflow the container
429+
</Item>
430+
<Item key="always">Always</Item>
431+
</Picker>
432+
</View>
433+
<hr />
434+
<View
435+
width={600}>
436+
<h4>Quiet picker with label and fixed width (600px)</h4>
437+
<Picker
438+
isQuiet
439+
label="Choose frequency"
440+
defaultSelectedKey="sometimes">
441+
<Item key="rarely">Rarely</Item>
442+
<Item key="sometimes">
443+
This text is very long the picker should expand to fit
444+
</Item>
445+
<Item key="always">Always</Item>
446+
</Picker>
447+
</View>
418448
</View>
419449
)
420450
};

0 commit comments

Comments
 (0)