useFocusReturn
Records currently focused element and returns focus to it when when is
set to false.
- @param
when- Whentrue, focus is recorded. Whenfalse, focus is returned. - @param
options- Configurable options - @returns void
Example
const [isDialogOpen, setIsDialogOpen] = useState(false)
useFocusReturn(isDialogOpen)
return (
<Dialog open={isDialogOpen} onClose={setIsDialogOpen} />
)