useFocusOnShow

useFocusOnShow is a custom hook that focuses on the target element when it is shown.

Usage

import { useFocusOnShow } from "@yamada-ui/react"
const ref = useRef<HTMLElement>(null)
const focusTargetRef = useRef<HTMLElement>(null)

useFocusOnShow(ref, {
  focusTarget: focusTargetRef,
  visible: true,
  shouldFocus: true,
})