diff --git a/packages/next/cms/hooks/useFocus.js b/packages/next/cms/hooks/useFocus.js new file mode 100644 index 000000000..08024de62 --- /dev/null +++ b/packages/next/cms/hooks/useFocus.js @@ -0,0 +1,12 @@ +import {useRef} from "react"; + +const useFocus = () => { + const htmlElRef = useRef(null); + const setFocus = () => { + if (htmlElRef.current) htmlElRef.current.focus(); + }; + + return [htmlElRef, setFocus]; +}; + +export {useFocus};