Accessibility
Components are built on native elements, and accessibility is checked automatically.
What is guaranteed
- Native
<button>and<a>: keyboard behaviour comes from the browser. - Text contrast of enabled buttons is at least 4.5:1 in the dark theme, and in the light theme when you import
tokens-accessible.css: at rest, on hover, on focus and when pressed. The default light colours are Ant Design's own and do not reach 4.5:1 for primary and danger fills and for links. Forghostit is guaranteed on the page background. - A focus ring with a contrast of at least 3:1 against the page background.
- A loading button keeps focus and gets
aria-busyandaria-disabled. prefers-reduced-motionis respected.
Icon-only buttons
The icon is hidden from assistive technology, so the button needs an accessible name:
<Button shape="circle" icon={searchIcon} aria-label="Search" /> How it is checked
Unit tests with axe-core, Playwright browser tests (contrast of every combination of type, danger and ghost, in the dark theme and in the light theme with the accessible colours) and mutation testing.