Giving a damn about accessibilityYour first attempt at making anything accessible will be awful. —Sheri Byrne-Haber
getByRole()
queryByRole()
findByRole()
getByRole({'textbox',{ name: 'Episode name' })
it('renders a link to play each episode', () => {
render(<EpisodeList />)
const link = screen.getByRole(
'link',
{ name: 'Play episode' }
)
expect(link).toBeInTheDocument()
})
TestingLibraryElementError: Found multiple elements with the role
"link" and name "Play episode"
function EpisodeList({episodes}) {
return (
<ul>
{episodes.map(({ title, url }) => (
<Episode key="{url}" title="{title}" url="{url}" />
))}
</ul>
)
}
function Episode({ title, url }) {
return (
<div>
{title} <PlayButton title="{title}" url="{url}" />
</div>
)
}
import { axe, toHaveNoViolations } from "jest-axe"
expect.extend(toHaveNoViolations)
it("is accessible", async () => {
const { container } = render(
<EpisodeList episodes="{mockEpisodes}" />
)
expect(await axe(container)).toHaveNoViolations()
})
<ul>
<div>
Those old scientists
<a href="./s2e7.html">
<img src="./play-button.svg" alt="Play episode: Those Old Scientists">
</a>
</div>
</ul>
Received:
"<ul> and <ol> must only directly contain <li>,
<script> or <template> elements (list)"setupAutoA11yTests()
import { test, expect } from '@playwright/test';
import AxeBuilder from '@axe-core/playwright';
test.describe('homepage', () => {
test('should not have any automatically detectable accessibility issues', async ({ page }) => {
await page.goto('https://your-site.com/');
const results =
await new AxeBuilder({ page }).analyze();
expect(results.violations).toEqual([]);
});
});
www.deque.com/blogDeque Study Shows Its Automated Testing Identifies 57 Percent of Digital Accessibility Issues, Surpassing Accepted Industry Benchmarks
Source:
Data's Love Of Cats In Star Trek Has An Ironic Real-Life Twist
GPT-5 miniClose-up of Star Trek: Picard characters Data (left) and Jean‑Luc Picard (right) seated side-by-side in profile facing right; Data’s pale, synthetic skin and dark hair contrast with Picard’s older, gray beard and thoughtful expression, both wearing dark jackets against a warm, softly lit background.
Source:
Data's Love Of Cats In Star Trek Has An Ironic Real-Life Twist
GPT-5 miniClose-up of Data (left) and his pet cat Spot (right) seated side-by-side in profile facing right; Data’s pale, synthetic skin and dark hair contrast with Spot’s orange-and-white fur, both lit by warm, soft lighting.
Source:
Data's Love Of Cats In Star Trek Has An Ironic Real-Life Twist
GPT-5 miniClose-up of Data (Brent Spiner) holding his orange-and-white tabby Spot; Data’s pale, android features and dark hair contrast with Spot’s fur as they sit side-by-side in warm, soft lighting, conveying a tender, nostalgic moment.
MeIn a scene from Star Trek: Picard, an elderly Data holds his cat, Spot, lovingly stroking Spot's head. The cat appears non-plussed.
Intopia's Accessibility Annotation Kit