From 934878ab4a1ee74735a4b06369e2581826acf9b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matuzal=C3=A9m=20Teles?= Date: Thu, 15 Jun 2023 21:40:28 -0500 Subject: [PATCH] fix(@clayui/multi-select): fix error when not invoking method of `onFocus` when defined --- packages/clay-multi-select/src/index.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/clay-multi-select/src/index.tsx b/packages/clay-multi-select/src/index.tsx index 8e174c05ef..f0f1d342d6 100644 --- a/packages/clay-multi-select/src/index.tsx +++ b/packages/clay-multi-select/src/index.tsx @@ -377,11 +377,18 @@ const ClayMultiSelect = React.forwardRef>( onChange={setValue} onFocus={ MenuRenderer && sourceItems - ? () => + ? ( + event: React.FocusEvent + ) => { + if (otherProps.onFocus) { + otherProps.onFocus(event); + } + setActive( !!value && sourceItems.length !== 0 - ) - : undefined + ); + } + : otherProps.onFocus } onFocusChange={setIsFocused} onItemsChange={hasAsyncItems ? () => {} : undefined}