Skip to content

Commit

Permalink
[docs] Use focus-visible instead of focus for Menu demos (mui#36847)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaldudak authored and binh1298 committed May 17, 2023
1 parent d5a8479 commit 0d9d20b
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 14 deletions.
5 changes: 3 additions & 2 deletions docs/data/base/components/menu/MenuSimple.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import Menu from '@mui/base/Menu';
import MenuItem, { menuItemClasses } from '@mui/base/MenuItem';
import Button, { buttonClasses } from '@mui/base/Button';
import Popper from '@mui/base/Popper';
import { styled } from '@mui/system';
import { ListActionTypes } from '@mui/base/useList';
Expand Down Expand Up @@ -165,7 +166,7 @@ const StyledMenuItem = styled(MenuItem)(
`,
);

const TriggerButton = styled('button')(
const TriggerButton = styled(Button)(
({ theme }) => `
font-family: IBM Plex Sans, sans-serif;
font-size: 0.875rem;
Expand All @@ -187,7 +188,7 @@ const TriggerButton = styled('button')(
border-color: ${theme.palette.mode === 'dark' ? grey[600] : grey[300]};
}
&:focus {
&.${buttonClasses.focusVisible} {
border-color: ${blue[400]};
outline: 3px solid ${theme.palette.mode === 'dark' ? blue[500] : blue[200]};
}
Expand Down
5 changes: 3 additions & 2 deletions docs/data/base/components/menu/MenuSimple.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import Menu, { MenuActions } from '@mui/base/Menu';
import MenuItem, { menuItemClasses } from '@mui/base/MenuItem';
import Button, { buttonClasses } from '@mui/base/Button';
import Popper from '@mui/base/Popper';
import { styled } from '@mui/system';
import { ListActionTypes } from '@mui/base/useList';
Expand Down Expand Up @@ -166,7 +167,7 @@ const StyledMenuItem = styled(MenuItem)(
`,
);

const TriggerButton = styled('button')(
const TriggerButton = styled(Button)(
({ theme }) => `
font-family: IBM Plex Sans, sans-serif;
font-size: 0.875rem;
Expand All @@ -188,7 +189,7 @@ const TriggerButton = styled('button')(
border-color: ${theme.palette.mode === 'dark' ? grey[600] : grey[300]};
}
&:focus {
&.${buttonClasses.focusVisible} {
border-color: ${blue[400]};
outline: 3px solid ${theme.palette.mode === 'dark' ? blue[500] : blue[200]};
}
Expand Down
5 changes: 3 additions & 2 deletions docs/data/base/components/menu/UnstyledMenuIntroduction.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import Menu from '@mui/base/Menu';
import MenuItem, { menuItemClasses } from '@mui/base/MenuItem';
import Button, { buttonClasses } from '@mui/base/Button';
import Popper from '@mui/base/Popper';
import { styled } from '@mui/system';
import { ListActionTypes } from '@mui/base/useList';
Expand Down Expand Up @@ -163,7 +164,7 @@ const StyledMenuItem = styled(MenuItem)(
`,
);

const TriggerButton = styled('button')(
const TriggerButton = styled(Button)(
({ theme }) => `
font-family: IBM Plex Sans, sans-serif;
font-size: 0.875rem;
Expand All @@ -185,7 +186,7 @@ const TriggerButton = styled('button')(
border-color: ${theme.palette.mode === 'dark' ? grey[600] : grey[300]};
}
&:focus {
&.${buttonClasses.focusVisible} {
border-color: ${blue[400]};
outline: 3px solid ${theme.palette.mode === 'dark' ? blue[500] : blue[200]};
}
Expand Down
5 changes: 3 additions & 2 deletions docs/data/base/components/menu/UnstyledMenuIntroduction.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import Menu, { MenuActions } from '@mui/base/Menu';
import MenuItem, { menuItemClasses } from '@mui/base/MenuItem';
import Button, { buttonClasses } from '@mui/base/Button';
import Popper from '@mui/base/Popper';
import { styled } from '@mui/system';
import { ListActionTypes } from '@mui/base/useList';
Expand Down Expand Up @@ -164,7 +165,7 @@ const StyledMenuItem = styled(MenuItem)(
`,
);

const TriggerButton = styled('button')(
const TriggerButton = styled(Button)(
({ theme }) => `
font-family: IBM Plex Sans, sans-serif;
font-size: 0.875rem;
Expand All @@ -186,7 +187,7 @@ const TriggerButton = styled('button')(
border-color: ${theme.palette.mode === 'dark' ? grey[600] : grey[300]};
}
&:focus {
&.${buttonClasses.focusVisible} {
border-color: ${blue[400]};
outline: 3px solid ${theme.palette.mode === 'dark' ? blue[500] : blue[200]};
}
Expand Down
2 changes: 1 addition & 1 deletion docs/data/base/components/menu/UseMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ const styles = `
border-color: ${grey[300]};
}
&:focus {
&:focus-visible {
border-color: ${blue[400]};
outline: 3px solid ${blue[200]};
}
Expand Down
2 changes: 1 addition & 1 deletion docs/data/base/components/menu/UseMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ const styles = `
border-color: ${grey[300]};
}
&:focus {
&:focus-visible {
border-color: ${blue[400]};
outline: 3px solid ${blue[200]};
}
Expand Down
4 changes: 2 additions & 2 deletions docs/data/base/components/menu/WrappedMenuItems.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import Menu from '@mui/base/Menu';
import MenuItem, { menuItemClasses } from '@mui/base/MenuItem';
import { buttonClasses } from '@mui/base/Button';
import Button, { buttonClasses } from '@mui/base/Button';
import Popper from '@mui/base/Popper';
import { styled } from '@mui/system';
import { ListActionTypes } from '@mui/base/useList';
Expand Down Expand Up @@ -199,7 +199,7 @@ const StyledMenuItem = styled(MenuItem)(
`,
);

const TriggerButton = styled('button')(
const TriggerButton = styled(Button)(
({ theme }) => `
font-family: IBM Plex Sans, sans-serif;
font-size: 0.875rem;
Expand Down
4 changes: 2 additions & 2 deletions docs/data/base/components/menu/WrappedMenuItems.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import Menu, { MenuActions } from '@mui/base/Menu';
import MenuItem, { menuItemClasses } from '@mui/base/MenuItem';
import { buttonClasses } from '@mui/base/Button';
import Button, { buttonClasses } from '@mui/base/Button';
import Popper from '@mui/base/Popper';
import { styled } from '@mui/system';
import { ListActionTypes } from '@mui/base/useList';
Expand Down Expand Up @@ -194,7 +194,7 @@ const StyledMenuItem = styled(MenuItem)(
`,
);

const TriggerButton = styled('button')(
const TriggerButton = styled(Button)(
({ theme }) => `
font-family: IBM Plex Sans, sans-serif;
font-size: 0.875rem;
Expand Down

0 comments on commit 0d9d20b

Please sign in to comment.