Fixes: Search filter dropdown should close on selection

This commit is contained in:
Tom Moor
2019-04-23 20:30:40 -07:00
parent 6d03257cc1
commit bc918b7bf5
2 changed files with 17 additions and 11 deletions

View File

@@ -44,6 +44,7 @@ const Anchor = styled('a')`
${HelpText} {
font-weight: normal;
user-select: none;
}
&:hover {

View File

@@ -31,16 +31,21 @@ const FilterOptions = ({
return (
<DropdownButton label={activeKey ? selectedLabel : defaultLabel}>
<List>
{options.map(option => (
<FilterOption
key={option.key}
onSelect={() => onSelect(option.key)}
active={option.key === activeKey}
{...option}
/>
))}
</List>
{({ closeMenu }) => (
<List>
{options.map(option => (
<FilterOption
key={option.key}
onSelect={() => {
onSelect(option.key);
closeMenu();
}}
active={option.key === activeKey}
{...option}
/>
))}
</List>
)}
</DropdownButton>
);
};
@@ -78,7 +83,7 @@ const SearchFilter = props => {
>
{({ closePortal }) => (
<MaxHeightScrollable>
<Content>{props.children}</Content>
<Content>{props.children({ closeMenu: closePortal })}</Content>
</MaxHeightScrollable>
)}
</DropdownMenu>