Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc] fix examples of custom UserMenu items across the docs to support keyboard navigation #8837

Merged
merged 9 commits into from
Apr 24, 2023
3 changes: 3 additions & 0 deletions docs/ContainerLayout.md
Original file line number Diff line number Diff line change
@@ -161,16 +161,19 @@ By default, the `<ContainerLayout>` shows a user menu with a single item (logout

{% raw %}
```jsx
import * as React from 'react';
import { Logout, UserMenu, useUserMenu } from 'react-admin';
import { MenuList, MenuItem, ListItemIcon, ListItemText } from '@mui/material';
import SettingsIcon from '@mui/icons-material/Settings';
import { ContainerLayout } from '@react-admin/ra-navigation';

// It's important to pass the ref to allow MUI to manage the keyboard navigation
const ConfigurationMenu = React.forwardRef((props, ref) => {
const { onClose } = useUserMenu();
return (
<MenuItem
ref={ref}
{/* It's important to pass the props to allow MUI to manage the keyboard navigation */}
{...props}
to="/configuration"
onClick={onClose}