mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
also deactivating flow display overlay on escape
This commit is contained in:
parent
5fef4bc804
commit
46a3e47cb2
1 changed files with 3 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
||||||
* Handles blur by detecting clicks outside refs.
|
* Handles blur by detecting clicks outside refs.
|
||||||
*/
|
*/
|
||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
|
import { useCloseOnEscape } from '~/utils/hooks/index';
|
||||||
|
|
||||||
export const useClickOutsideFocus = () => {
|
export const useClickOutsideFocus = () => {
|
||||||
const ref = useRef<HTMLElement>();
|
const ref = useRef<HTMLElement>();
|
||||||
|
@ -26,5 +27,7 @@ export const useClickOutsideFocus = () => {
|
||||||
return () => document.removeEventListener('mouseup', deactivator);
|
return () => document.removeEventListener('mouseup', deactivator);
|
||||||
}, [isActive]);
|
}, [isActive]);
|
||||||
|
|
||||||
|
useCloseOnEscape(deactivate);
|
||||||
|
|
||||||
return { ref, isActive, activate, deactivate };
|
return { ref, isActive, activate, deactivate };
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue