From efb793f3ec135a8a8f2124af1a682f83ef04732d Mon Sep 17 00:00:00 2001
From: smeng9 <38666763+smeng9@users.noreply.github.com>
Date: Mon, 17 Apr 2023 15:28:46 +0800
Subject: [PATCH 1/9] update useLogout UserMenu
---
docs/useLogout.md | 3 +++
1 file changed, 3 insertions(+)
diff --git a/docs/useLogout.md b/docs/useLogout.md
index 481a6427309..f2ccf34d575 100644
--- a/docs/useLogout.md
+++ b/docs/useLogout.md
@@ -15,6 +15,7 @@ import { AppBar, Layout, UserMenu, useLogout } from 'react-admin';
import { MenuItem } from '@mui/material';
import ExitIcon from '@mui/icons-material/PowerSettingsNew';
+// It's important to pass the ref to allow MUI to manage the keyboard navigation
const MyLogoutButton = forwardRef((props, ref) => {
const logout = useLogout();
const handleClick = () => logout();
@@ -22,6 +23,8 @@ const MyLogoutButton = forwardRef((props, ref) => {
From e7cbc62aafd057cded48376bde65756f0606bc0e Mon Sep 17 00:00:00 2001
From: smeng9 <38666763+smeng9@users.noreply.github.com>
Date: Mon, 17 Apr 2023 15:36:21 +0800
Subject: [PATCH 2/9] Fix forwardRef for AppBar UserMenu
---
docs/AppBar.md | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/docs/AppBar.md b/docs/AppBar.md
index 50d9dbafbe7..e948ce20822 100644
--- a/docs/AppBar.md
+++ b/docs/AppBar.md
@@ -238,21 +238,29 @@ The content of the user menu depends on the return value of `authProvider.getIde
You can customize the user menu by passing a `userMenu` prop to the `` component.
```jsx
+import * as React from 'react';
import { AppBar, UserMenu, useUserMenu } from 'react-admin';
import { MenuItem, ListItemIcon, ListItemText } from '@mui/material';
import SettingsIcon from '@mui/icons-material/Settings';
-const SettingsMenuItem = () => {
+// It's important to pass the ref to allow MUI to manage the keyboard navigation
+const SettingsMenuItem = React.forwardRef((props, ref) => {
+ // We are not using MenuItemLink so we retrieve the onClose function from the UserContext
const { onClose } = useUserMenu();
return (
-