Repository navigation
feat(ui): EnhancedSimulationForm WCAG 2.1 AA accessibility contract + reachability-based focus tests - #67
Conversation
…ble tally + voter-card.v1)
…atch, jsdom env, ResizeObserver mock
…n landmark, heading roles, status/alert semantics
…rm — labeled slider inputs, validation alerts, tab landmarks
… tablist/tabpanel composite semantics
…uous label regexes, shift-tab off-by-one, schema drift, form-scoped tab queries
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 60b0ccd735
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| { id: 'GROUP_BUY_SAVINGS_PERCENT', label: 'Group Buy Savings', description: 'Discount members get by buying food together in bulk. Savings from collective purchasing power.', min: 0, max: 30, step: 1, errorUnit: 'value', format: 'percent' }, | ||
| { id: 'LOCAL_PRODUCTION_SAVINGS_PERCENT', label: 'Local Production Savings', description: 'Additional savings from food produced locally by the cooperative itself, cutting out middlemen.', min: 0, max: 30, step: 1, errorUnit: 'value', format: 'percent' }, |
There was a problem hiding this comment.
Keep savings percentages in fractional units
Use fractional bounds such as 0.3/0.4 here, or explicitly convert percentage-point input before updating the model. These parameters default to 0.15 and 0.25 and are consumed directly as rates in src/lib/simulation/index.ts; the new bounds accept an intuitive entry such as 15 as valid, display it as 1,500%, and feed that value into the simulation's savings calculation, producing invalid experimental results.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 18a9b6b: bounds are now fractional (0-1, step 0.05) matching the model units — formatPercentage uses style:percent so 0.15 renders as 15%. The DEFAULT_PARAMS values (0.15/0.25) now validate cleanly instead of tripping the 0-30 range checks.
| }); | ||
| }; | ||
|
|
||
| const handleSubmit = async (e: React.FormEvent) => { |
There was a problem hiding this comment.
Block submission while parameter errors exist
Validate all raw fields and return without invoking either callback when any value is invalid. The text inputs update localParams even for out-of-range finite values, but this handler submits unconditionally, so entering five members or an excessive savings rate shows an error while still storing and eventually running the invalid parameters; clearing a required field similarly submits the previous hidden model value.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 18a9b6b: handleSubmit now runs validateAllFields() and returns early (merging errors into state) when any parameter is invalid — neither onParamsChange nor onSubmit fires until all 14 fields pass.
| if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Home', 'End', 'PageUp', 'PageDown'].includes(e.key)) { | ||
| e.preventDefault(); |
There was a problem hiding this comment.
Restore keyboard value changes for slider controls
Allow the standard slider keys to change the value, or expose these controls as ordinary text/spinbutton inputs instead of role="slider". For keyboard and assistive-technology users, the controls are announced as sliders, but this handler cancels Arrow, Home, End, and Page key behavior without implementing replacements, leaving none of the advertised slider interactions operable.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 18a9b6b: full ARIA slider keyboard pattern implemented — ArrowUp/Down/Left/Right step by step (clamped to bounds), Home/End jump to min/max, PageUp/PageDown x10; changes commit through the same validated path as typing. The functional test was updated to the ARIA-correct expectation (25 + step 10 = 35); the blanket preventDefault is gone.
| type="button" | ||
| tabIndex={-1} | ||
| aria-label="More information about expected benefits" | ||
| className="text-muted-foreground cursor-help" |
There was a problem hiding this comment.
Keep tooltip triggers reachable from the keyboard
Remove the negative tab index or provide another keyboard-operable way to reveal this information. A sighted keyboard-only user can no longer focus the expected-benefits trigger, so the margin-of-error and downturn explanation remains available through pointer hover but cannot be opened from the keyboard.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 18a9b6b: removed tabIndex={-1} from the ExpectedBenefits info trigger — it is now a normal keyboard stop. (Per-field form triggers intentionally keep -1: the authored form tests define that stop structure and those triggers duplicate each field's visible label + sr-only description.)
8b6cd08
into
PMOVES.AI-Edition-Hardened
Summary
Completes the EnhancedSimulationForm accessibility contract that PR #66 identified as remaining work. Stacked on the test-infra repairs from #66.
feat(ui): form a11y contract (ec26616)
fix(testing): reachability-based focus verification (f5cbed1)
test(ui): suite authoring corrections (60b0ccd)
Verification
Known remaining work (follow-up PRs)