Add 'Esc' hotkey behavior on Filter and Sorts dropdown (#1622)

* fix esc key

* add changes

* add changes

* add changes
This commit is contained in:
neo773
2023-09-20 15:10:49 +05:30
committed by GitHub
parent 103fb701e7
commit d8590bb358
4 changed files with 18 additions and 2 deletions

View File

@ -85,6 +85,10 @@ export const SortDropdownButton = ({
);
};
const handleDropdownButtonClose = () => {
resetState();
};
return (
<DropdownButton
dropdownId={SortDropdownId}
@ -135,6 +139,7 @@ export const SortDropdownButton = ({
)}
</StyledDropdownMenu>
}
onClose={handleDropdownButtonClose}
></DropdownButton>
);
};

View File

@ -43,7 +43,7 @@ export const ViewBar = ({
hotkeyScope={{ scope: FiltersHotkeyScope.FilterDropdownButton }}
/>
<SortDropdownButton
hotkeyScope={{ scope: FiltersHotkeyScope.FilterDropdownButton }}
hotkeyScope={{ scope: FiltersHotkeyScope.SortDropdownButton }}
isPrimaryButton
/>
{optionsDropdownButton}

View File

@ -1,3 +1,4 @@
export enum FiltersHotkeyScope {
FilterDropdownButton = 'filter-dropdown-button',
SortDropdownButton = 'sort-dropdown-button',
}