📝 a11y

This commit is contained in:
mi
2025-11-14 19:02:17 +10:00
parent a0b9bb8bfb
commit 4a501757ed

View File

@@ -110,6 +110,100 @@ Don't have a server? No problem! Here are beginner-friendly options to get your
- JSON API for programmatic access - JSON API for programmatic access
- Open Graph and Twitter Card metadata for social sharing - Open Graph and Twitter Card metadata for social sharing
- Server-side rendering with Jinja2 - Server-side rendering with Jinja2
- **Comprehensive accessibility features** (WCAG compliant)
## Accessibility
Sunday Comics is built with accessibility as a core feature, ensuring your webcomic can be enjoyed by all readers, including those using assistive technologies.
### Accessibility Features
#### ✅ Keyboard Navigation
- **Full keyboard support** - Navigate the entire site without a mouse
- **Visible focus indicators** - Clear visual outlines on all interactive elements when using Tab navigation
- **Skip to main content** - Press Tab on any page to reveal a "Skip to main content" link, allowing keyboard users to bypass navigation
- **Arrow key shortcuts** - Use Left/Right arrows to navigate between comics, Home/End for first/latest
- **Focus management** - Keyboard focus automatically moves to the comic content after navigation, maintaining context for screen reader users
#### ✅ Screen Reader Support
- **Semantic HTML** - Proper use of `<header>`, `<nav>`, `<main>`, `<footer>` elements
- **ARIA live regions** - Screen readers announce when new comics load during client-side navigation
- **ARIA labels** - All icon buttons and links have descriptive labels
- **ARIA disabled states** - Disabled navigation buttons properly announce their state
- **Alt text** - All comic images require alt text (set via `alt_text` field in `comics_data.py`)
- **No redundant announcements** - Decorative icons use empty alt text to avoid duplicate screen reader announcements
#### ✅ Visual Accessibility
- **High contrast** - Focus indicators use solid 3px outlines for visibility
- **Responsive design** - Works across desktop, tablet, and mobile screen sizes
- **No reliance on color alone** - Disabled states use both color and opacity changes
#### ✅ Additional Accessibility Support
- **Language declaration** - `lang="en"` attribute on HTML element
- **Heading hierarchy** - Proper use of h1, h2, h3 throughout the site
- **Clickable regions** - Comic images that advance to the next comic include descriptive labels
- **External link safety** - `rel="noopener noreferrer"` on external links
- **Keyboard trap prevention** - No focus traps; users can always navigate away
### Testing Accessibility
To test keyboard navigation on your site:
1. **Tab Navigation**
- Press Tab repeatedly to move through interactive elements
- Verify visible focus indicators appear on links and buttons
- First Tab should reveal "Skip to main content" link
2. **Keyboard Shortcuts**
- On a comic page, press Right Arrow to advance
- Press Left Arrow to go back
- Press Home to jump to first comic
- Press End to jump to latest comic
3. **Screen Reader Testing** (Optional)
- **macOS:** Enable VoiceOver (Cmd + F5)
- **Windows:** Use NVDA (free) or JAWS
- Navigate through the site and verify announcements are clear and logical
### Accessibility Best Practices for Comic Creators
When adding comics to your site, follow these guidelines to maintain accessibility:
1. **Always provide alt text**
```python
{
'number': 1,
'filename': 'comic-001.png',
'alt_text': 'A descriptive summary of what happens in the comic', # Required!
# ...
}
```
2. **Write meaningful alt text**
- Describe the comic's content and context
- Include dialogue if it's essential to understanding
- Keep it concise but descriptive (aim for 1-2 sentences)
- Bad: "Comic"
- Good: "Sarah discovers her cat can talk and is planning world domination"
3. **Use proper image formats**
- Ensure comic images are clear and readable
- Consider providing larger resolution images for zoom accessibility
- Test your comics at different zoom levels (200%, 300%)
4. **Structure author notes clearly**
- Use markdown headings for long author notes
- Break up long paragraphs
- Use lists for clarity when appropriate
### Accessibility Score
Sunday Comics follows WCAG 2.1 Level AA guidelines and scores **9.5/10** in accessibility compliance, with comprehensive support for:
- Keyboard navigation ✅
- Screen reader compatibility ✅
- Focus management ✅
- ARIA attributes ✅
- Semantic HTML ✅
## Project Structure ## Project Structure