You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: content/guides/react/hooks/use-open-and-close-focus.mdx
+12-9
Original file line number
Diff line number
Diff line change
@@ -5,14 +5,16 @@ description: A utility Hook that focuses an element when a component is first mo
5
5
6
6
`useOpenAndCloseFocus` is a utility Hook that manages focusing an element when a component is first mounted, and returns focus to an element on the page when that component unmounts.
7
7
8
-
If no ref is passed to `initialFocusRef` , the hook focuses the first focusable element inside of the container.
8
+
If no ref is passed to `initialFocusRef`, the hook focuses the first focusable element inside of the container.
9
+
10
+
If `preventFocusOnOpen` prop is passed, then no focus will be applied when component mounts, even if `initialFocusRef` prop is included. Only initial focus is prevented; focus will still be returned to `returnFocusRef` when component unmounts.
0 commit comments