Skip to content

Commit 2e528c0

Browse files
tw15eganandreancardonakodiakhq[bot]
authored
fix(ListBox): Standardize ListBox menu open behavior (#13268)
* style(MultiSelect): update styles to fix invalid issues when focused * style(FluidMultiselect): adjust focus styles when invalid * chore(log): remove console log * fix(ListBox): align open behaviors across ListBox components --------- Co-authored-by: Andrea N. Cardona <cardona.n.andrea@gmail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent 05d64ad commit 2e528c0

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

packages/react/src/components/Dropdown/Dropdown.stories.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ Playground.argTypes = {
121121
control: {
122122
type: 'text',
123123
},
124-
defaultValue: 'this is an example label',
124+
defaultValue: 'This is an example label',
125125
},
126126
warn: {
127127
control: {
@@ -139,7 +139,7 @@ Playground.argTypes = {
139139
control: {
140140
type: 'text',
141141
},
142-
defaultValue: 'this is an example title',
142+
defaultValue: 'This is an example title',
143143
},
144144
size: {
145145
options: ['sm', 'md', 'lg'],
@@ -158,7 +158,6 @@ export const Default = () => (
158158
id="default"
159159
titleText="Dropdown label"
160160
helperText="This is some helper text"
161-
initialSelectedItem={items[0]}
162161
label="Dropdown menu options"
163162
items={items}
164163
itemToString={(item) => (item ? item.text : '')}
@@ -171,7 +170,6 @@ export const Inline = () => (
171170
<Dropdown
172171
id="inline"
173172
titleText="Inline dropdown label"
174-
initialSelectedItem={items[0]}
175173
label="Dropdown menu options"
176174
type="inline"
177175
items={items}
@@ -186,7 +184,6 @@ export const WithLayer = () => (
186184
id="default"
187185
titleText="First Layer"
188186
helperText="This is some helper text"
189-
initialSelectedItem={items[0]}
190187
label="Dropdown menu options"
191188
items={items}
192189
itemToString={(item) => (item ? item.text : '')}
@@ -196,7 +193,6 @@ export const WithLayer = () => (
196193
id="default"
197194
titleText="Second Layer"
198195
helperText="This is some helper text"
199-
initialSelectedItem={items[0]}
200196
label="Dropdown menu options"
201197
items={items}
202198
itemToString={(item) => (item ? item.text : '')}
@@ -206,7 +202,6 @@ export const WithLayer = () => (
206202
id="default"
207203
titleText="Third Layer"
208204
helperText="This is some helper text"
209-
initialSelectedItem={items[0]}
210205
label="Dropdown menu options"
211206
items={items}
212207
itemToString={(item) => (item ? item.text : '')}
@@ -221,7 +216,6 @@ export const InlineWithLayer = () => (
221216
<Dropdown
222217
id="inline"
223218
titleText="First Layer"
224-
initialSelectedItem={items[0]}
225219
label="Dropdown menu options"
226220
type="inline"
227221
items={items}
@@ -231,7 +225,6 @@ export const InlineWithLayer = () => (
231225
<Dropdown
232226
id="inline"
233227
titleText="Second Layer"
234-
initialSelectedItem={items[0]}
235228
label="Dropdown menu options"
236229
type="inline"
237230
items={items}
@@ -241,7 +234,6 @@ export const InlineWithLayer = () => (
241234
<Dropdown
242235
id="inline"
243236
titleText="Third Layer"
244-
initialSelectedItem={items[0]}
245237
label="Dropdown menu options"
246238
type="inline"
247239
items={items}

packages/react/src/components/MultiSelect/FilterableMultiSelect.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,10 @@ const FilterableMultiSelect = React.forwardRef(function FilterableMultiSelect(
302302
event.stopPropagation();
303303
}
304304

305+
if (match(event, keys.Enter)) {
306+
handleOnMenuChange(true);
307+
}
308+
305309
if (!disabled) {
306310
if (match(event, keys.Delete) || match(event, keys.Escape)) {
307311
if (isOpen) {

packages/react/src/components/MultiSelect/MultiSelect.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,10 @@ const MultiSelect = React.forwardRef(function MultiSelect<ItemType>(
478478
clearSelection();
479479
e.stopPropagation();
480480
}
481+
482+
if (match(e, keys.Space) || match(e, keys.ArrowDown)) {
483+
setIsOpenWrapper(true);
484+
}
481485
}
482486
};
483487

0 commit comments

Comments
 (0)