Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ListBox): Standardize ListBox menu open behavior #13268

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions packages/react/src/components/Dropdown/Dropdown.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Playground.argTypes = {
control: {
type: 'text',
},
defaultValue: 'this is an example label',
defaultValue: 'This is an example label',
},
warn: {
control: {
Expand All @@ -139,7 +139,7 @@ Playground.argTypes = {
control: {
type: 'text',
},
defaultValue: 'this is an example title',
defaultValue: 'This is an example title',
},
size: {
options: ['sm', 'md', 'lg'],
Expand All @@ -158,7 +158,6 @@ export const Default = () => (
id="default"
titleText="Dropdown label"
helperText="This is some helper text"
initialSelectedItem={items[0]}
label="Dropdown menu options"
items={items}
itemToString={(item) => (item ? item.text : '')}
Expand All @@ -171,7 +170,6 @@ export const Inline = () => (
<Dropdown
id="inline"
titleText="Inline dropdown label"
initialSelectedItem={items[0]}
label="Dropdown menu options"
type="inline"
items={items}
Expand All @@ -186,7 +184,6 @@ export const WithLayer = () => (
id="default"
titleText="First Layer"
helperText="This is some helper text"
initialSelectedItem={items[0]}
label="Dropdown menu options"
items={items}
itemToString={(item) => (item ? item.text : '')}
Expand All @@ -196,7 +193,6 @@ export const WithLayer = () => (
id="default"
titleText="Second Layer"
helperText="This is some helper text"
initialSelectedItem={items[0]}
label="Dropdown menu options"
items={items}
itemToString={(item) => (item ? item.text : '')}
Expand All @@ -206,7 +202,6 @@ export const WithLayer = () => (
id="default"
titleText="Third Layer"
helperText="This is some helper text"
initialSelectedItem={items[0]}
label="Dropdown menu options"
items={items}
itemToString={(item) => (item ? item.text : '')}
Expand All @@ -221,7 +216,6 @@ export const InlineWithLayer = () => (
<Dropdown
id="inline"
titleText="First Layer"
initialSelectedItem={items[0]}
label="Dropdown menu options"
type="inline"
items={items}
Expand All @@ -231,7 +225,6 @@ export const InlineWithLayer = () => (
<Dropdown
id="inline"
titleText="Second Layer"
initialSelectedItem={items[0]}
label="Dropdown menu options"
type="inline"
items={items}
Expand All @@ -241,7 +234,6 @@ export const InlineWithLayer = () => (
<Dropdown
id="inline"
titleText="Third Layer"
initialSelectedItem={items[0]}
label="Dropdown menu options"
type="inline"
items={items}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,10 @@ const FilterableMultiSelect = React.forwardRef(function FilterableMultiSelect(
event.stopPropagation();
}

if (match(event, keys.Enter)) {
handleOnMenuChange(true);
}

if (!disabled) {
if (match(event, keys.Delete) || match(event, keys.Escape)) {
if (isOpen) {
Expand Down
4 changes: 4 additions & 0 deletions packages/react/src/components/MultiSelect/MultiSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,10 @@ const MultiSelect = React.forwardRef(function MultiSelect<ItemType>(
clearSelection();
e.stopPropagation();
}

if (match(e, keys.Space) || match(e, keys.ArrowDown)) {
setIsOpenWrapper(true);
}
}
};

Expand Down