From 4989abc11ccf4202fdd5d409644fb7fcc971a996 Mon Sep 17 00:00:00 2001 From: Zishan Ahmad Date: Tue, 16 Jan 2024 17:14:43 +0530 Subject: [PATCH] additionally fixed the same issue in paginatedSelectFiltered as well --- .../PaginatedSelect/PaginatedSelect.tsx | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/fuselage/src/components/PaginatedSelect/PaginatedSelect.tsx b/packages/fuselage/src/components/PaginatedSelect/PaginatedSelect.tsx index e1b983b358..e58960ad41 100644 --- a/packages/fuselage/src/components/PaginatedSelect/PaginatedSelect.tsx +++ b/packages/fuselage/src/components/PaginatedSelect/PaginatedSelect.tsx @@ -65,14 +65,16 @@ export const PaginatedSelect = ({ (filter === undefined || visible === AnimatedVisibility.HIDDEN) && (valueLabel || placeholder || typeof placeholder === 'string'); + const handleOnMouseDown = useEffectEvent(() => { + visible === AnimatedVisibility.VISIBLE ? hide() : show(); + }); + + const handleBlur = useEffectEvent(() => { + visible === AnimatedVisibility.VISIBLE && hide(); + }); + const handleClick = useEffectEvent(() => { - if (visible === AnimatedVisibility.VISIBLE) { - return hide(); - } - if (ref && ref.current) { - ref.current.focus(); - return show(); - } + ref && ref.current && ref.current.focus(); }); return ( @@ -80,6 +82,7 @@ export const PaginatedSelect = ({ rcx-select disabled={disabled} ref={containerRef} + onMouseDown={handleOnMouseDown} onClick={handleClick} className={useMemo( () => [error && 'invalid', disabled && 'disabled'], @@ -110,8 +113,8 @@ export const PaginatedSelect = ({ filter={filter} ref={ref} aria-haspopup='listbox' - onClick={show} - onBlur={hide} + // onClick={show} + onBlur={handleBlur} />