diff --git a/front/src/modules/ui/dropdown/components/DropdownButton.tsx b/front/src/modules/ui/dropdown/components/DropdownButton.tsx
index aae66abc6..cda6da034 100644
--- a/front/src/modules/ui/dropdown/components/DropdownButton.tsx
+++ b/front/src/modules/ui/dropdown/components/DropdownButton.tsx
@@ -3,6 +3,7 @@ import { Keys } from 'react-hotkeys-hook';
import { flip, offset, Placement, useFloating } from '@floating-ui/react';
import { HotkeyEffect } from '@/ui/utilities/hotkey/components/HotkeyEffect';
+import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
@@ -19,7 +20,7 @@ type OwnProps = {
key: Keys;
scope: string;
};
- dropdownHotkeyScope?: HotkeyScope;
+ dropdownHotkeyScope: HotkeyScope;
dropdownPlacement?: Placement;
onClickOutside?: () => void;
onClose?: () => void;
@@ -67,6 +68,15 @@ export const DropdownButton = ({
dropdownHotkeyScope,
});
+ useScopedHotkeys(
+ 'esc',
+ () => {
+ closeDropdownButton();
+ },
+ dropdownHotkeyScope.scope,
+ [closeDropdownButton],
+ );
+
return (
{hotkey && (
diff --git a/front/src/modules/ui/view-bar/components/SortDropdownButton.tsx b/front/src/modules/ui/view-bar/components/SortDropdownButton.tsx
index f3e70ca72..cd9a8b6c1 100644
--- a/front/src/modules/ui/view-bar/components/SortDropdownButton.tsx
+++ b/front/src/modules/ui/view-bar/components/SortDropdownButton.tsx
@@ -85,6 +85,10 @@ export const SortDropdownButton = ({
);
};
+ const handleDropdownButtonClose = () => {
+ resetState();
+ };
+
return (
}
+ onClose={handleDropdownButtonClose}
>
);
};
diff --git a/front/src/modules/ui/view-bar/components/ViewBar.tsx b/front/src/modules/ui/view-bar/components/ViewBar.tsx
index edeae0ac8..be9550305 100644
--- a/front/src/modules/ui/view-bar/components/ViewBar.tsx
+++ b/front/src/modules/ui/view-bar/components/ViewBar.tsx
@@ -43,7 +43,7 @@ export const ViewBar = ({
hotkeyScope={{ scope: FiltersHotkeyScope.FilterDropdownButton }}
/>
{optionsDropdownButton}
diff --git a/front/src/modules/ui/view-bar/types/FiltersHotkeyScope.ts b/front/src/modules/ui/view-bar/types/FiltersHotkeyScope.ts
index b2b3ca801..84c5dcbe6 100644
--- a/front/src/modules/ui/view-bar/types/FiltersHotkeyScope.ts
+++ b/front/src/modules/ui/view-bar/types/FiltersHotkeyScope.ts
@@ -1,3 +1,4 @@
export enum FiltersHotkeyScope {
FilterDropdownButton = 'filter-dropdown-button',
+ SortDropdownButton = 'sort-dropdown-button',
}