import React from 'react'; import { ComponentStory, ComponentMeta } from '@storybook/react'; import Box from '../../ui/box'; import { BorderColor, DISPLAY, FLEX_DIRECTION, } from '../../../helpers/constants/design-system'; import { ModalFocus } from './modal-focus'; import README from './README.mdx'; export default { title: 'Components/ComponentLibrary/ModalFocus', component: ModalFocus, parameters: { docs: { page: README, }, }, args: { children: ( <>
Modal focus children
Use the keyboard to try tabbing around you will notice that the focus is locked to the content within modal focus
> ), }, } as ComponentMetaModal focus children
> ), }; export const InitialFocusRef = (args) => { const ref = React.useRefInitial focus is on the close button
, }; export const FinalFocusRef = (args) => { const ref = React.useRefFocus will be returned to the input once closed
Focus will be restored to the open button once closed
auto focus set to false
, };