diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d8fcc41d1d..c13a1354eb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -227,7 +227,32 @@ describe('featureName', () => { > [!TIP] > If you need access to the Nuxt context in your unit or component test, place your test in the `test/nuxt/` directory and run with `pnpm test:nuxt` -### E2e tests +### Component accessibility tests + +All new components should have a basic accessibility test in `test/nuxt/components.spec.ts`. These tests use [axe-core](https://github.com/dequelabs/axe-core) to catch common accessibility violations. + +```typescript +import MyComponent from '~/components/MyComponent.vue' + +describe('MyComponent', () => { + it('should have no accessibility violations', async () => { + const component = await mountSuspended(MyComponent, { + props: { + /* required props */ + }, + }) + const results = await runAxe(component) + expect(results.violations).toEqual([]) + }) +}) +``` + +The `runAxe` helper handles DOM isolation and disables page-level rules that don't apply to isolated component testing. + +> [!IMPORTANT] +> Just because axe-core doesn't find any obvious issues, it does not mean a component is accessible. Please do additional checks and use best practices. + +### End to end tests Write end-to-end tests using Playwright: diff --git a/app/app.vue b/app/app.vue index 040daa6114..22bd00681d 100644 --- a/app/app.vue +++ b/app/app.vue @@ -285,7 +285,7 @@ button { border-left: 2px solid #262626; padding-left: 1rem; margin: 1.5rem 0; - color: #666666; + color: #8a8a8a; font-style: italic; } diff --git a/app/components/CodeViewer.vue b/app/components/CodeViewer.vue index 9d5d9c5229..b3b95d2ee0 100644 --- a/app/components/CodeViewer.vue +++ b/app/components/CodeViewer.vue @@ -66,6 +66,7 @@ watch( :id="`L${lineNum}`" :key="lineNum" :href="`#L${lineNum}`" + tabindex="-1" class="line-number block px-3 py-0 font-mono text-sm leading-6 cursor-pointer transition-colors no-underline" :class="[ isLineSelected(lineNum) diff --git a/app/components/OgImage/Default.vue b/app/components/OgImage/Default.vue index 0f2d2521bd..a2f5170c2e 100644 --- a/app/components/OgImage/Default.vue +++ b/app/components/OgImage/Default.vue @@ -1,7 +1,7 @@