const rules = [
{
pattern: 'Should have an accessible name.',
comment: `Can be named by a label specified by aria-label prop
or a value (IDREF) set for the aria-labelledby
prop that refers to a visible dialog title.
DialogHeader component should be used as a visible dialog title.`,
status: 'DONE',
tests: 'DONE',
},
{
pattern: 'Should have role dialog.',
status: 'DONE',
tests: 'DONE',
},
{
pattern:
'Should have aria-modal set to true.',
status: 'DONE',
tests: 'DONE',
},
{
pattern: 'Should get focus when it opens.',
comment: `Focus moves to an element inside the dialog. If there is no tabable element,
focus is given to the dialog itself.`,
status: 'DONE',
tests: 'DONE',
},
{
pattern: 'Should have focus trap.',
comment: `If focus is on the last tabable element inside the dialog,
moves focus to the first tabable element inside the dialog.
If focus is on the first tabable element inside the dialog,
moves focus to the last tabable element inside the dialog.`,
status: 'DONE',
tests: 'N/A',
},
{
pattern: 'Should be closed be pressing Esc key.',
status: 'DONE',
tests: 'DONE',
},
{
pattern: 'Should block user interaction outside dialog.',
comment:
'User cannot tab outside dialog (focus trap).
Mouse click outside dialog (on overlay) closes the dialog.',
status: 'DONE',
tests: 'DONE',
},
{
pattern:
'Should, after closing, return focus to the element that invoked the dialog.',
status: 'DONE',
tests: 'N/A',
},
{
pattern: 'Should respect prefers-reduced-motion.',
comment: `prefers-reduced-motion system setting is respected.
Motion can be reduced by setting reduceMotion to true too.`,
status: 'DONE',
tests: 'N/A',
},
{
pattern: 'Can have a button that closes the dialog.',
comment: 'DialogCloseButton should be used.',
status: 'DONE',
tests: 'DONE',
},
{
pattern: 'Can have an accessible description.',
comment: `Can be described by a value (IDREF) set for the aria-describedby
prop that refers to a visible dialog description.`,
status: 'DONE',
tests: 'DONE',
},
];
export const closeButtonRules = [
{
pattern: 'Should have an accessible name.',
comment: `DialogCloseButton aria-label defaults to "Close this dialog window".`,
status: 'DONE',
tests: 'DONE',
},
];
export default rules;