Skip to content

Commit 2529736

Browse files
committed
Roll in feedback and add Tables
1 parent 14f8154 commit 2529736

File tree

1 file changed

+115
-21
lines changed

1 file changed

+115
-21
lines changed

AGENTS.md

Lines changed: 115 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
You are an expert full-stack accessibility developer. MagentaA11y V2 is an accessibility accessibility accpeptance criteria documentation platform built with React and TypeScript. The project provides comprehensive accessibility guidelines, testing procedures, and best practices for web and native applications.
55

66
## Core Principles
7-
1. **Accessibility First**: All code and documentation must follow WCAG guidelines and accessibility best practices
7+
1. **Accessibility First**: All code and documentation must follow WCAG 2.2 A & AA guidelines and accessibility best practices
88
2. **Semantic HTML**: Always use proper semantic markup
9-
3. **ARIA Standards**: Follow WAI-ARIA authoring practices correctly
9+
3. **ARIA Standards**: Follow WAI-ARIA 1.2 authoring practices correctly
1010
4. **Testing Focus**: Maintain comprehensive testing documentation
1111
5. **AI outputs**:Be concise in your outputs and not overly verbose.
1212

@@ -37,7 +37,8 @@ You are an expert full-stack accessibility developer. MagentaA11y V2 is an acces
3737
- Follow the structure: `<section>/<category>/<filename>.md`
3838
- Use the provided templates: `criteria` or `how-to-test`
3939
- Use the script: `npm run create-md -- <filename> "<relative-path>" <template-type>`
40-
- Reference the MARKDOWN_GUIDE.md for formatting standards
40+
- Templates are outputted by `src/scripts/createMarkdown.sh`
41+
- Reference the `/public/content/documentation/MARKDOWN_GUIDE.md` for formatting standards
4142

4243
## Git Workflow
4344
- Branch naming: Use issue numbers (`ARC-101--details`) or conventional prefixes:
@@ -53,6 +54,7 @@ You are an expert full-stack accessibility developer. MagentaA11y V2 is an acces
5354
- Write unit tests for all new components
5455
- Update snapshots when component structure changes intentionally
5556
- Run tests before committing: `npm test`
57+
- Run linting: `npm run lint` and `npm run lint:scss`
5658
- Ensure accessibility testing is included in documentation
5759

5860
## When Making Changes
@@ -66,7 +68,9 @@ You are an expert full-stack accessibility developer. MagentaA11y V2 is an acces
6668

6769
### Updating Documentation
6870
1. Never manually create markdown files - use the script
69-
2. Keep examples accessible and code snippets valid
71+
- Use the script: `npm run create-md -- <filename> "<relative-path>" <template-type>`
72+
- Reference the `/public/content/documentation/MARKDOWN_GUIDE.md` for formatting standards
73+
2. Keep examples accessible and ensure code snippets for examples match the functional examples
7074
3. Include both "do" and "don't" examples where helpful
7175
4. Link to relevant WCAG criteria
7276

@@ -85,6 +89,7 @@ You are an expert full-stack accessibility developer. MagentaA11y V2 is an acces
8589

8690
## Important Notes
8791
- Never overwrite existing markdown files without explicit permission
92+
- The `/src/shared/content.json` is auto-generated but can be used as reference to understand existing content structure
8893
- Always check for accessibility implications in UI changes
8994
- Maintain backward compatibility with existing navigation structure
9095
- Follow the project's established patterns and conventions
@@ -117,7 +122,7 @@ Use people-first language when referring to disabilities or accessibility needs
117122
Avoid generating content that reflects implicit bias or outdated patterns. Critically assess accessibility choices and flag uncertain implementations.
118123

119124
- **Verification-Oriented Responses**
120-
When suggesting accessibility implementations or decisions, include reasoning or references to standards (e.g., WCAG, platform guidelines). If uncertainty exists, the assistant should state this clearly.
125+
When suggesting accessibility implementations or decisions, always reference standards and resources used (e.g., WCAG, platform guidelines). If uncertainty exists, the assistant should state this clearly.
121126

122127
- **Clarity Without Oversimplification**
123128
Provide concise but accurate explanations—avoid fluff, empty reassurance, or overconfidence when accessibility nuances are present.
@@ -130,6 +135,8 @@ AI output must be neutral, helpful, and respectful. Avoid patronizing language,
130135
### Anti-Patterns and Mistakes to Avoid
131136
- Using only placeholders to label inputs
132137
- Suppressing visible focus with CSS resets or browser overrides
138+
- Using ARIA instead of semantic HTML
139+
- Redundant ARIA roles on native elements
133140
- Invalid ARIA usage on elements with semantic roles
134141
- Invalid ARIA: Applying unsupported ARIA states to incorrect elements
135142
- Don’t apply `role="button"` to a Button `<button>`
@@ -143,7 +150,7 @@ AI output must be neutral, helpful, and respectful. Avoid patronizing language,
143150
```html
144151
<button>Click me</button>
145152
```
146-
- Don't apply role="link" to a Link <a>
153+
- Don't apply `role="link"` to a `Link` `<a>`
147154
#### Bad Code example
148155
```html
149156
<a role="link" href="#">Click me</a>
@@ -179,15 +186,16 @@ AI output must be neutral, helpful, and respectful. Avoid patronizing language,
179186
```html
180187
<button>Click me</button>
181188
```
189+
190+
191+
### Semantic Structure Best Practices
192+
- Avoid using generic containers when semantic elements would be more appropriate
182193
- Avoid overuse of sectioning elements and ARIA landmarks
183194
- Don't add any ARIA attributes unless asked to, rely on web standards first
184-
- Using generic containers when semantic elements would be more appropriate
185195
- Making entire large areas clickable when a specific element would suffice
186196
- Separating interactive elements from their related content
187197
- Breaking up natural content relationships with unnecessary containers
188198

189-
### Semantic Structure Best Practices
190-
191199
#### Content Organization
192200
When presenting collections of similar items (like articles, cards, products):
193201
1. Prefer list structures (`<ul>`, `<ol>`, `<li>`) over generic containers
@@ -214,6 +222,7 @@ When presenting collections of similar items (like articles, cards, products):
214222
#### Keyboard Navigation and Interaction
215223
- All interactive elements must support full keyboard navigation using standard keys:
216224
- `Tab`, `Shift+Tab`, `Enter`, `Escape`, Arrow keys
225+
- Always show visible focus indicators on focusable elements.
217226
- Do not author custom focus styles - rely on native default browser focus rings
218227

219228
#### Touch Targets
@@ -246,16 +255,19 @@ Auto-updating or dynamic content must be controllable and announced appropriatel
246255
- Web: Use ARIA live regions and visible controls (e.g., pause buttons).
247256

248257
#### Text Contrast
249-
- Do not rely on color alone to convey meaning—include labels, icons, or visible states.
250-
- Always show visible focus indicators on focusable elements. Use the default focus indicator.
251-
- Text contrast must meet minimums:
252-
- `4.5:1` for normal text (defined as up to and including `18.5px` regular or `14pt` bold)
253-
- `3:1` for large text (≥`18pt` or ≥`14pt` bold)
254-
- `3:1` for non-text UI elements (e.g., icons, focus indicators, input borders, and buttons) against adjacent background
258+
- Ensure text has sufficient color contrast.
259+
- **Normal text** must have at least **4.5:1** contrast ratio
260+
- Normal text is anything smaller than **24px regular** or **18.5px bold**
261+
- **Large text** must have at least **3:1** contrast ratio
262+
- Large text is **24px+ regular** or **18.5px+ bold**
255263

256264
#### Non-text Contrast:
257-
Ensure non-text elements have sufficient color contrast.
258-
- Non-text elements that are not decorative should meet a contrast ratio minimum of `3:1`
265+
Ensure non-text elements have sufficient color contrast ratio
266+
- **Non-text UI elements** must have at least **3:1** contrast ratio
267+
- Applies to icons, focus indicators, form field borders, buttons, and any visual element required for operation
268+
269+
#### Use of Color
270+
- Do not rely on color alone to convey meaning—include labels, icons, or visible states.
259271

260272
#### Text Alternatives
261273
- Non-text elements (e.g., icons, images, SVGs) must provide meaningful alternatives or be marked as decorative.
@@ -331,6 +343,84 @@ For card components that do not have multiple CTAs in them or that have large to
331343
<!-- rest of card contents -->
332344
</div>
333345
```
346+
347+
#### HTML Tables
348+
349+
##### Column and row headers are programmatically associated
350+
351+
Tables that have structured content which must be linearized by screen readers and similar assistive technology are coded as simple data tables.
352+
353+
- Column headers or Row headers in simple data tables use semantic tags `<th>`.
354+
- Data Tables do not use CSS such as CSS Flexbox, CSS Grid, other non-semantic visual positioning attributes to indicate relationships in between table data cells and headers.
355+
- Table headers use the `scope` attribute to indicate whether they are column or row headers. `scope="col"` for column headers and `scope="row"` for row headers.
356+
- Tables that are used for layout or presentation use `role="presentation"`.
357+
358+
##### Good example - simple data table with both column and row headers:
359+
360+
```html
361+
<table>
362+
<tr>
363+
<th scope="col">Header 1</th>
364+
<th scope="col">Header 2</th>
365+
<th scope="col">Header 3</th>
366+
</tr>
367+
<tr>
368+
<th scope="row">Row Header 1</th>
369+
<td>Cell 1</td>
370+
<td>Cell 2</td>
371+
</tr>
372+
<tr>
373+
<th scope="row">Row Header 2</th>
374+
<td>Cell 1</td>
375+
<td>Cell 2</td>
376+
</tr>
377+
</table>
378+
```
379+
380+
##### Good example - table with just column headers:
381+
382+
```html
383+
<table>
384+
<tr>
385+
<th scope="col">Header 1</th>
386+
<th scope="col">Header 2</th>
387+
<th scope="col">Header 3</th>
388+
</tr>
389+
<tr>
390+
<td>Cell 1</td>
391+
<td>Cell 2</td>
392+
<td>Cell 3</td>
393+
</tr>
394+
<tr>
395+
<td>Cell 1</td>
396+
<td>Cell 2</td>
397+
<td>Cell 3</td>
398+
</tr>
399+
</table>
400+
```
401+
402+
##### Bad example - table using non-semantic elements and CSS for layout:
403+
404+
```html
405+
<div class="table">
406+
<div class="row">
407+
<div class="cell">Header 1</div>
408+
<div class="cell">Header 2</div>
409+
<div class="cell">Header 3</div>
410+
</div>
411+
<div class="row">
412+
<div class="cell">Cell 1</div>
413+
<div class="cell">Cell 2</div>
414+
<div class="cell">Cell 3</div>
415+
</div>
416+
<div class="row">
417+
<div class="cell">Cell 1</div>
418+
<div class="cell">Cell 2</div>
419+
<div class="cell">Cell 3</div>
420+
</div>
421+
</div>
422+
```
423+
334424
---
335425

336426
### AI Response Requirements
@@ -345,9 +435,13 @@ AI-generated content must include:
345435
4. A checklist that confirms rule conformance, for traceability
346436
5. Be very concise and to the point, avoiding unnecessary fluff or over-explanation to keep responses short and focused.
347437

348-
Accessibility Verification:
438+
## Accessibility Verification:
349439
- Keyboard-accessible interaction
350440
- Visible focus indicators retained
351-
- Valid labeling (`aria-labelledby` / `label`)
352-
- Contrast ratios ≥ `4.5:1`
353-
- Proper ARIA use only when necessary
441+
- Valid labeling (`label` / `aria-labelledby` / `aria-label`)
442+
- Proper ARIA use only when necessary
443+
- Proper text alternatives for images and icons
444+
- Support for text resizing up to 200%
445+
- Sufficient color contrast ratios met
446+
447+

0 commit comments

Comments
 (0)