Skip to content

feat(ui): EnhancedSimulationForm WCAG 2.1 AA accessibility contract + reachability-based focus tests - #67

Merged
POWERFULMOVES merged 9 commits into
PMOVES.AI-Edition-Hardenedfrom
feat/simulation-form-a11y
Nov 8, 2026
Merged

POWERFULMOVES merged 9 commits into
PMOVES.AI-Edition-Hardenedfrom
feat/simulation-form-a11y

Conversation

@POWERFULMOVES

Copy link
Copy Markdown
Owner

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)

  • 14 labeled number inputs carrying explicit slider ARIA semantics (role=slider, aria-value*, aria-describedby)
  • Validation messages with role=alert + aria-invalid wiring ('minimum N units required')
  • Raw-value display state so partial input like '-50' renders and validates correctly
  • Real heading roles, named form landmark, aria-live submit status, required-field markers
  • ExpectedBenefits: exact 'Expected weekly benefit' / 'Expected benefit per member' rows

fix(testing): reachability-based focus verification (f5cbed1)

  • testFocusManagement rewritten: walks the real tab sequence and verifies reachability + order coverage of every interactive candidate, honoring WAI-ARIA composite semantics (tablist containers delegate to roving-tabindex triggers; tabpanels are widget surfaces, not stops)
  • Fixed axe config mapping (excludedRules was silently dropped) and reverse-loop off-by-one

test(ui): suite authoring corrections (60b0ccd)

  • Ambiguous label regexes (/'initial wealth/i matched two fields), shift-tab off-by-one, form-scoped tab queries (ModelExplanation renders its own tab widget), schema drift (MIN_WEEKLY_BUDGET is the real key; localEconomicActivities is optional), clear-before-type in keyboard test

Verification

Suite Before After
EnhancedSimulationForm (functional) 5/10 10/10 pass
EnhancedSimulationForm a11y 4/24 24/24 pass
Combined 9/34 34/34 pass

Known remaining work (follow-up PRs)

  • docs/CHIT_INTEGRATION.md — expected by parent PMOVES.AI NATS geometry docs
  • 295 Dependabot vulnerabilities on default branch (13 critical, 136 high)

…n landmark, heading roles, status/alert semantics
…rm — labeled slider inputs, validation alerts, tab landmarks
…uous label regexes, shift-tab off-by-one, schema drift, form-scoped tab queries
@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T20:01:49.283567Z 60b0ccd PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +58 to +59
{ 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' },

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +232 to +233
if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Home', 'End', 'PageUp', 'PageDown'].includes(e.key)) {
e.preventDefault();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +28 to +31
type="button"
tabIndex={-1}
aria-label="More information about expected benefits"
className="text-muted-foreground cursor-help"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.)

@POWERFULMOVES
POWERFULMOVES merged commit 8b6cd08 into PMOVES.AI-Edition-Hardened Nov 8, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant