Skip to content

Commit

Permalink
[docs][base-ui] Improve focus trap demo
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Sep 16, 2023
1 parent 40aaf7b commit c5e3af8
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 8 deletions.
9 changes: 8 additions & 1 deletion docs/data/base/components/focus-trap/BasicFocusTrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ export default function BasicFocusTrap() {
const [open, setOpen] = React.useState(false);

return (
<Box sx={{ display: 'flex', alignItems: 'center', flexDirection: 'column' }}>
<Box
sx={{
display: 'flex',
alignItems: 'center',
flexDirection: 'column',
'& [tabindex]:focus': { outline: '1px solid green' },
}}
>
<button type="button" onClick={() => setOpen(true)}>
Open
</button>
Expand Down
9 changes: 8 additions & 1 deletion docs/data/base/components/focus-trap/BasicFocusTrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ export default function BasicFocusTrap() {
const [open, setOpen] = React.useState(false);

return (
<Box sx={{ display: 'flex', alignItems: 'center', flexDirection: 'column' }}>
<Box
sx={{
display: 'flex',
alignItems: 'center',
flexDirection: 'column',
'& [tabindex]:focus': { outline: '1px solid green' },
}}
>
<button type="button" onClick={() => setOpen(true)}>
Open
</button>
Expand Down
9 changes: 8 additions & 1 deletion docs/data/base/components/focus-trap/DisableEnforceFocus.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ export default function DisableEnforceFocus() {
const [open, setOpen] = React.useState(false);

return (
<Box sx={{ display: 'flex', alignItems: 'center', flexDirection: 'column' }}>
<Box
sx={{
display: 'flex',
alignItems: 'center',
flexDirection: 'column',
'& [tabindex]:focus': { outline: '1px solid green' },
}}
>
<button type="button" onClick={() => setOpen(true)}>
Open
</button>
Expand Down
9 changes: 8 additions & 1 deletion docs/data/base/components/focus-trap/DisableEnforceFocus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ export default function DisableEnforceFocus() {
const [open, setOpen] = React.useState(false);

return (
<Box sx={{ display: 'flex', alignItems: 'center', flexDirection: 'column' }}>
<Box
sx={{
display: 'flex',
alignItems: 'center',
flexDirection: 'column',
'& [tabindex]:focus': { outline: '1px solid green' },
}}
>
<button type="button" onClick={() => setOpen(true)}>
Open
</button>
Expand Down
9 changes: 8 additions & 1 deletion docs/data/base/components/focus-trap/LazyFocusTrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ export default function LazyFocusTrap() {
const [open, setOpen] = React.useState(false);

return (
<Box sx={{ display: 'flex', alignItems: 'center', flexDirection: 'column' }}>
<Box
sx={{
display: 'flex',
alignItems: 'center',
flexDirection: 'column',
'& [tabindex]:focus': { outline: '1px solid green' },
}}
>
<button type="button" onClick={() => setOpen(true)}>
Open
</button>
Expand Down
9 changes: 8 additions & 1 deletion docs/data/base/components/focus-trap/LazyFocusTrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ export default function LazyFocusTrap() {
const [open, setOpen] = React.useState(false);

return (
<Box sx={{ display: 'flex', alignItems: 'center', flexDirection: 'column' }}>
<Box
sx={{
display: 'flex',
alignItems: 'center',
flexDirection: 'column',
'& [tabindex]:focus': { outline: '1px solid green' },
}}
>
<button type="button" onClick={() => setOpen(true)}>
Open
</button>
Expand Down
9 changes: 8 additions & 1 deletion docs/data/base/components/focus-trap/PortalFocusTrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ export default function PortalFocusTrap() {
const [container, setContainer] = React.useState(null);

return (
<Box sx={{ display: 'flex', alignItems: 'center', flexDirection: 'column' }}>
<Box
sx={{
display: 'flex',
alignItems: 'center',
flexDirection: 'column',
'& [tabindex]:focus': { outline: '1px solid green' },
}}
>
<button type="button" onClick={() => setOpen(true)}>
Open
</button>
Expand Down
9 changes: 8 additions & 1 deletion docs/data/base/components/focus-trap/PortalFocusTrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ export default function PortalFocusTrap() {
const [container, setContainer] = React.useState<HTMLElement | null>(null);

return (
<Box sx={{ display: 'flex', alignItems: 'center', flexDirection: 'column' }}>
<Box
sx={{
display: 'flex',
alignItems: 'center',
flexDirection: 'column',
'& [tabindex]:focus': { outline: '1px solid green' },
}}
>
<button type="button" onClick={() => setOpen(true)}>
Open
</button>
Expand Down

0 comments on commit c5e3af8

Please sign in to comment.