Skip to content

Commit

Permalink
Close dropdown after selection or click outside the list
Browse files Browse the repository at this point in the history
Signed-off-by: Radoslaw Szwajkowski <[email protected]>
  • Loading branch information
rszwajko committed Sep 4, 2024
1 parent 236cf63 commit 3efb63c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions client/src/app/components/FilterToolbar/FilterToolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ export const FilterToolbar = <TItem, TFilterCategoryKey extends string>({
{!showFiltersSideBySide && (
<ToolbarItem>
<Dropdown
onOpenChange={(flag) => setIsCategoryDropdownOpen(flag)}
toggle={(toggleRef) => (
<MenuToggle
id="filtered-by"
Expand Down
4 changes: 4 additions & 0 deletions client/src/app/components/ToolbarBulkSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export const ToolbarBulkSelector = <T,>({
<DropdownItem
onClick={() => {
handleSelectAll(false);
setIsOpen(false);
}}
data-action="none"
key="select-none"
Expand All @@ -91,6 +92,7 @@ export const ToolbarBulkSelector = <T,>({
currentPageItems.map((item: T) => item),
true
);
setIsOpen(false);
}}
data-action="page"
key="select-page"
Expand All @@ -101,6 +103,7 @@ export const ToolbarBulkSelector = <T,>({
<DropdownItem
onClick={() => {
handleSelectAll(true);
setIsOpen(false);
}}
data-action="all"
key="select-all"
Expand All @@ -116,6 +119,7 @@ export const ToolbarBulkSelector = <T,>({
<ToolbarItem>
<Dropdown
isOpen={isOpen}
onOpenChange={(flag) => setIsOpen(flag)}
toggle={(toggleRef) => (
<MenuToggle
ref={toggleRef}
Expand Down

0 comments on commit 3efb63c

Please sign in to comment.