Skip to content

Commit

Permalink
🐛 Close dropdown after selection or click outside the list (#2077)
Browse files Browse the repository at this point in the history
Fix applies to bulk selection dropdown and to filter categories dropdown
on all table-based screens.

Resolves:  https://issues.redhat.com/browse/MTA-3321

Signed-off-by: Radoslaw Szwajkowski <[email protected]>
  • Loading branch information
rszwajko authored Sep 4, 2024
1 parent db1ac8c commit 16f166f
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 16f166f

Please sign in to comment.