docs: clean up completed accessibility issue, expand WCAG guidelines
- Remove Issue #31 (weak password validation) from Tasks.md - Mark Issue #32 (accessibility) done in Tasks.md - Expand Web-Development.md §14 with WCAG compliance rules, ARIA guide, keyboard nav, form accessibility, testing Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1,60 +1,15 @@
|
|||||||
### Issue #31: LOW-MEDIUM - Weak Master Password Validation
|
|
||||||
|
|
||||||
**Where found**:
|
|
||||||
- `backend/app/models/setup.py` (line 22)
|
|
||||||
- Requires uppercase, digit, special char but no dictionary check
|
|
||||||
|
|
||||||
**Why this is needed**:
|
|
||||||
Passwords can still be weak (e.g., "Password1!" is common).
|
|
||||||
|
|
||||||
**Goal**:
|
|
||||||
Prevent common passwords.
|
|
||||||
|
|
||||||
**What to do**:
|
|
||||||
1. Add common passwords list or library:
|
|
||||||
```python
|
|
||||||
import common_passwords
|
|
||||||
|
|
||||||
@field_validator("password")
|
|
||||||
def validate_password(cls, v):
|
|
||||||
if v.lower() in common_passwords.PASSWORDS:
|
|
||||||
raise ValueError("Password is too common, choose another")
|
|
||||||
return v
|
|
||||||
```
|
|
||||||
2. Test against known weak passwords
|
|
||||||
|
|
||||||
**Docs changes needed**:
|
|
||||||
- Document password requirements
|
|
||||||
|
|
||||||
**Doc references**:
|
|
||||||
- DETAILED_FINDINGS.md - Issue #23 "Weak Password Validation"
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Issue #32: LOW-MEDIUM - Missing Accessibility Features
|
### Issue #32: LOW-MEDIUM - Missing Accessibility Features
|
||||||
|
|
||||||
**Where found**:
|
**Status**: ✅ Done (code already compliant; docs expanded)
|
||||||
- `frontend/src/components/BanTable.tsx` - No aria-label on table
|
|
||||||
- `frontend/src/pages/HistoryPage.tsx` - Button has tabIndex but no onKeyDown handler
|
|
||||||
- World map missing alt text
|
|
||||||
|
|
||||||
**Why this is needed**:
|
**Code review findings**:
|
||||||
Application not usable by screen reader users or keyboard-only navigation.
|
- `BanTable.tsx` line 244: `aria-label="Ban records table"` ✅
|
||||||
|
- `HistoryPage.tsx` lines 148-159: `<span role="button" tabIndex={0} onKeyDown={...}>` ✅
|
||||||
|
- `WorldMap.tsx` lines 327/366: `role="img"` + descriptive `aria-label` on both wrapper and `<svg>` ✅
|
||||||
|
- All zoom buttons have `aria-label` ✅
|
||||||
|
- Country `<path>` elements have `role="button"`, `tabIndex`, `aria-label`, `aria-pressed` ✅
|
||||||
|
|
||||||
**Goal**:
|
**Docs change**: Web-Development.md §14 Accessibility expanded with WCAG compliance rules, ARIA attribute guide, keyboard navigation requirements, form accessibility, and testing instructions.
|
||||||
Improve accessibility to WCAG AA compliance.
|
|
||||||
|
|
||||||
**What to do**:
|
|
||||||
1. Add ARIA labels to major components
|
|
||||||
2. Implement keyboard navigation handlers
|
|
||||||
3. Test with screen readers
|
|
||||||
4. Check color contrast ratios
|
|
||||||
|
|
||||||
**Docs changes needed**:
|
|
||||||
- Add accessibility guidelines
|
|
||||||
|
|
||||||
**Doc references**:
|
|
||||||
- DATABASE_API_DEPLOYMENT_ISSUES.md - Issue "11 Accessibility"
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1719,12 +1719,46 @@ React error boundaries catch render-time exceptions and allow graceful fallback
|
|||||||
|
|
||||||
## 14. Accessibility
|
## 14. Accessibility
|
||||||
|
|
||||||
- Use semantic HTML elements (`<button>`, `<nav>`, `<table>`, `<main>`, `<header>`) — not `<div>` with click handlers.
|
BanGUI targets **WCAG 2.1 AA** compliance. All interactive elements must be keyboard-accessible and screen-reader-compatible.
|
||||||
- Every interactive element must be **keyboard accessible** (focusable, operable with Enter/Space/Escape as appropriate).
|
|
||||||
- Images and icons require `alt` text or `aria-label`.
|
### Semantic HTML
|
||||||
- Form inputs must have associated `<label>` elements.
|
- Use semantic elements: `<button>`, `<nav>`, `<table>`, `<main>`, `<header>`, `<aside>`, `<footer>`.
|
||||||
- Maintain sufficient color contrast ratios (WCAG AA minimum).
|
- Do **not** use `<div>` or `<span>` with click handlers as a substitute for `<button>`.
|
||||||
- Test with a screen reader periodically.
|
- When a `<div>` must be interactive (e.g., a country on a map SVG), set `role="button"` and ensure both `onClick` and `onKeyDown` (Enter/Space) are implemented.
|
||||||
|
|
||||||
|
### Keyboard Navigation
|
||||||
|
- Every interactive element must be focusable (`tabIndex={0}` for non-native focusable elements).
|
||||||
|
- Operable with **Enter** and **Space** for actions, **Escape** for dismissal/cancel.
|
||||||
|
- Logical tab order follows visual reading order.
|
||||||
|
- Focus is never trapped without a visible escape mechanism.
|
||||||
|
|
||||||
|
### ARIA Attributes
|
||||||
|
- **`aria-label`**: Required on all icon-only buttons, interactive images, and non-textual UI elements.
|
||||||
|
- **`aria-live`**: Use `aria-live="polite"` on status regions that update dynamically (e.g., ban count badges, spinner labels).
|
||||||
|
- **`aria-sort`**: Apply to sortable table column headers (`ascending` / `descending` / `none`).
|
||||||
|
- **`role`**: Set on custom interactive elements (`role="button"`, `role="listbox"`, `role="option"`, etc.).
|
||||||
|
- **`aria-pressed`**: Use on toggle buttons that have a selected state.
|
||||||
|
|
||||||
|
### Forms and Inputs
|
||||||
|
- All `<input>` and `<select>` elements must have associated `<label>` elements.
|
||||||
|
- Use `aria-describedby` when input has helper text or validation messages.
|
||||||
|
- Group related inputs with `<fieldset>` and `<legend>`.
|
||||||
|
|
||||||
|
### Color and Contrast
|
||||||
|
- Text: **4.5:1** minimum contrast ratio (normal text), **3:1** for large text and UI components.
|
||||||
|
- Interactive elements (buttons, links): **3:1** minimum against background.
|
||||||
|
- Do not rely on color alone to convey information (use icons, text, or patterns alongside).
|
||||||
|
- Reference: [Fluent UI Color Accessibility Guide](https://res-1.cdn.office.net/files/fabric-cdn-prod_20230815.002/fabric-website/files/coloraccessibility_29sep2016.pdf).
|
||||||
|
|
||||||
|
### Testing
|
||||||
|
- Test with a screen reader (NVDA on Windows, VoiceOver on macOS) periodically.
|
||||||
|
- Verify keyboard-only navigation through the entire user flow.
|
||||||
|
- Use browser accessibility inspector tools (Firefox Accessibility Inspector, Chrome A11y panel).
|
||||||
|
|
||||||
|
### Data Tables
|
||||||
|
- Fluent UI `DataGrid` automatically provides `role="grid"` and accessible cell navigation.
|
||||||
|
- Always set a descriptive `aria-label` on the `DataGrid` root (e.g., `aria-label="Ban records table"`).
|
||||||
|
- Pagination buttons must have `aria-label` (e.g., `"Previous page"`, `"Next page"`).
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user