Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions .changeset/sour-zoos-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/fuselage': patch
---

fix: ensure MultiSelect dropdown closes on addon click
11 changes: 9 additions & 2 deletions packages/fuselage/src/components/MultiSelect/MultiSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,20 +144,25 @@ const MultiSelect = forwardRef<HTMLInputElement, MultiSelectProps>(
return show();
});

const handleAddonClick = useEffectEvent((e: SyntheticEvent) => {
e.stopPropagation();
e.preventDefault();
handleClick();
});

return (
<Box
is='div'
rcx-select
className={[error && 'invalid', disabled && 'disabled']}
ref={containerRef}
onClick={handleClick}
disabled={disabled}
{...props}
>
<FlexItem grow={1}>
<Margins inline='x4'>
<FlexContainer>
<Box is='div'>
<Box is='div' onClick={handleClick}>
<Box
is='div'
display='flex'
Expand Down Expand Up @@ -216,6 +221,8 @@ const MultiSelect = forwardRef<HTMLInputElement, MultiSelectProps>(
<FlexItem grow={0} shrink={0}>
<Margins inline='x4'>
<SelectAddon
onMouseDown={(e) => e.preventDefault()}
onClick={handleAddonClick}
children={
<Icon
name={
Expand Down