1
0
mirror of https://github.com/keeweb/keeweb.git synced 2024-06-28 07:50:55 +02:00
This commit is contained in:
antelle 2021-06-12 16:32:21 +02:00
parent 2baf2b0dcf
commit 8a9243b639
No known key found for this signature in database
GPG Key ID: 63C9777AAB7C563C

View File

@ -16,8 +16,18 @@ export const AppContextMenu: FunctionComponent = () => {
useKey(Keys.DOM_VK_RETURN, () => ContextMenu.closeWithSelectedResult(), undefined, 'dropdown');
useEffect(() => {
const hideMenu = () => {
ContextMenu.hide();
const hideMenu = (e: KeyboardEvent) => {
if (
![
Keys.DOM_VK_UP,
Keys.DOM_VK_DOWN,
Keys.DOM_VK_RETURN,
Keys.DOM_VK_ESCAPE,
Keys.DOM_VK_RETURN
].includes(e.which)
) {
ContextMenu.hide();
}
};
document.addEventListener('keydown', hideMenu);
return () => document.removeEventListener('keydown', hideMenu);