From 763e480419520e2725d102bc5f2a7dbf50a4927d Mon Sep 17 00:00:00 2001 From: Riddhi Bansal <41935566+riddhybansal@users.noreply.github.com> Date: Wed, 19 Jun 2024 13:08:41 +0530 Subject: [PATCH] fix: filterable multiselect search issue (#16729) * fix: filterable multiselect search issue * fix: removed consoles * fix: removed test story --- .../src/components/MultiSelect/FilterableMultiSelect.tsx | 7 ++----- .../src/components/MultiSelect/MultiSelect.stories.js | 1 + 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/react/src/components/MultiSelect/FilterableMultiSelect.tsx b/packages/react/src/components/MultiSelect/FilterableMultiSelect.tsx index 785471470d62..482f5414b542 100644 --- a/packages/react/src/components/MultiSelect/FilterableMultiSelect.tsx +++ b/packages/react/src/components/MultiSelect/FilterableMultiSelect.tsx @@ -448,7 +448,6 @@ const FilterableMultiSelect = React.forwardRef(function FilterableMultiSelect< if (changes.isOpen && !isOpen) { setTopItems(controlledSelectedItems); } - switch (type) { case InputKeyDownEnter: if (changes.selectedItem && changes.selectedItem.disabled !== true) { @@ -465,6 +464,8 @@ const FilterableMultiSelect = React.forwardRef(function FilterableMultiSelect< return changes; case InputBlur: case InputKeyDownEscape: + setInputFocused(false); + setInputValue(''); setIsOpen(false); return changes; case FunctionToggleMenu: @@ -659,10 +660,6 @@ const FilterableMultiSelect = React.forwardRef(function FilterableMultiSelect< } }, onFocus: () => setInputFocused(true), - onBlur() { - setInputFocused(false); - setInputValue(''); - }, }) ); const menuProps = getMenuProps({}, { suppressRefError: true }); diff --git a/packages/react/src/components/MultiSelect/MultiSelect.stories.js b/packages/react/src/components/MultiSelect/MultiSelect.stories.js index 8381bdd3a1cc..9e259abaeb97 100644 --- a/packages/react/src/components/MultiSelect/MultiSelect.stories.js +++ b/packages/react/src/components/MultiSelect/MultiSelect.stories.js @@ -15,6 +15,7 @@ import MultiSelect from '.'; import FilterableMultiSelect from './FilterableMultiSelect'; import Button from '../Button'; import ButtonSet from '../ButtonSet'; +import { Tabs, Tab, TabList, TabPanels, TabPanel } from '@carbon/react'; export default { title: 'Components/MultiSelect',