Skip to content

Latest commit

 

History

History
49 lines (33 loc) · 950 Bytes

no-empty-buttons.md

File metadata and controls

49 lines (33 loc) · 950 Bytes

Accessibility: Button, ToggleButton, SplitButton, MenuButton, CompoundButton must either text content or icon or child component (@microsoft/fluentui-jsx-a11y/no-empty-buttons)

💼 This rule is enabled in the ✅ recommended config.

Buttons must either have text, content or accessible labelling

https://www.w3.org/TR/html-aria/

Rule Details

This rule aims to make a button to have something to generate an aria-label.

Examples of incorrect code for this rule:

<Button></Button>
<Button />
<Button title="Toggle Example"></Button>
<Button aria-label="Toggle Example"></Button>

Examples of correct code for this rule:

<Button>Example</Button>
<Button title="Toggle Example">Example</Button>
<Button icon={<CloseIcon />} aria-label="Close" />
<Button icon={<CloseIcon />}>Button</Button>