Added User List table
This commit is contained in:
14
src/hooks/use-prevent-auto-focus.ts
Normal file
14
src/hooks/use-prevent-auto-focus.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { useCallback, useRef } from 'react';
|
||||
|
||||
function usePreventAutoFocus<E extends HTMLElement = HTMLDivElement>() {
|
||||
const ref = useRef<E>(null);
|
||||
|
||||
const onOpenAutoFocus = useCallback((event: Event) => {
|
||||
event.preventDefault();
|
||||
ref.current?.focus({ preventScroll: true });
|
||||
}, []);
|
||||
|
||||
return { ref, onOpenAutoFocus, tabIndex: -1 as const };
|
||||
}
|
||||
|
||||
export default usePreventAutoFocus;
|
||||
Reference in New Issue
Block a user