Skip to content

feat(a11y): add jest-axe and jsx-a11y with baseline for SettlementTable and MetricsBar - #438

Merged
Jagadeeshftw merged 1 commit into
AnchorNet-Org:mainfrom
Opulencechuks:add-accessibility-checks
Aug 29, 2026
Merged

feat(a11y): add jest-axe and jsx-a11y with baseline for SettlementTable and MetricsBar#438
Jagadeeshftw merged 1 commit into
AnchorNet-Org:mainfrom
Opulencechuks:add-accessibility-checks

Conversation

@Opulencechuks

Copy link
Copy Markdown
Contributor

Closes #428

Description

This PR introduces accessibility verification to the AnchorNet-Frontend codebase targeting the WCAG 2.1 AA baseline. To prevent a11y regressions without overwhelming the team with existing violations on day one, I have implemented a targeted baseline approach.

Layer-Ranking & Scope Strategy:

  • jest-axe (Highest value-per-effort): Leverages our existing vitest suite to catch rendered-output violations without new infrastructure. I have scoped this gate to our highest-traffic and most data-dense components (SettlementTable and MetricsBar).
  • eslint-plugin-jsx-a11y (High value-per-effort): Added to the flat config to catch static markup problems cheaply at author time directly in the editor.

Changes Made:

  • Configured eslint-plugin-jsx-a11y and jest-axe.
  • Fixed existing a11y violations in SettlementTable (added scope="col" to headers and sr-only text to action columns).
  • Baselined ToastProvider by suppressing a tabIndex warning with a documented reason, keeping its keyboard operability intact while keeping the build green.
  • Added a11y.test.tsx which asserts zero violations for SettlementTable and MetricsBar, and verifies keyboard operability for actionable settlements.

Checklist

  • I added a CHANGELOG.md entry under the next ## [x.y.z] section
    (see the Format note at the top of CHANGELOG.md), or this PR
    is docs-only / test-only / internal tooling and doesn't change
    user-facing behavior.
  • Tests added/updated for the change.

@Jagadeeshftw
Jagadeeshftw merged commit 003e833 into AnchorNet-Org:main Aug 29, 2026
Jagadeeshftw added a commit that referenced this pull request Aug 29, 2026
* Fix CI typecheck blindspot

Closes #425

* test: use semantic settlement table queries (#439)

Co-authored-by: Jagadeeshftw <92681651+Jagadeeshftw@users.noreply.github.com>

* feat(a11y): add jest-axe and jsx-a11y with baseline for SettlementTable and MetricsBar (#438)

* fix(test): type MetricsBar's useAsync mock against the real hook shape (Closes #429) (#437)

MetricsBar.test.tsx mocked useAsync with only { state, refresh }, omitting
reload and mutate, so tsc reported TS2345 at all four call sites and the
component was verified against a contract the real hook never returns.

Replace the hand-written mocks with a typed mockUseAsync factory whose
return type is ReturnType<typeof useAsync>; a future change to the hook's
shape now breaks compilation instead of silently testing a fabricated
interface. No as any, @ts-expect-error or Partial cast used.

MetricsBar itself only consumes state and refresh (reload/mutate are
intentionally unused: the manual refresh must stay silent, which is
refresh's contract), so no behavioural gap was found. Repo-wide tsc error
count drops from 9 to 5; the remaining 5 are the out-of-scope
SettlementTable.test.tsx errors.

Generated with Codebuff 🤖

Co-authored-by: Codebuff <noreply@codebuff.com>

* fix(api): enforce idempotent retries and classified failure handling (#436)

* fix(api): enforce bounded idempotent retries

Retry only explicitly idempotent operations for transient failures, preserve abort propagation through response consumption, and expose deterministic attempt and elapsed-time bounds. Cover the status allowlist, jittered backoff, timeout handling, abort races, and non-idempotent exclusions with fake-timer tests.

* fix(ui): integrate API error taxonomy

Route classified API failures through the existing reporter and toast infrastructure, suppress deliberate aborts, and preserve actionable inline states. Document the pre-change audit, defects, retry rationale, elapsed ceiling, coverage, and baseline constraints.

* test: add tests for lib/wallet.ts (#435)

Closes #<n>.

### Coverage Inventory
* **wallet.ts exports**: `saveAccount`, `loadAccount`, `clearAccount`, `truncateAddress`, `mockAddress`, `STORAGE_KEY`.
* **useWallet.test.ts**: Covers *none* of the above. It only tests the `useWallet` hook to ensure it throws when used outside a `WalletProvider`.

### The Defect (Mocking Strategy & Incorrect Assumptions)
The issue description assumed that `wallet.ts` implements a real wallet integration with error paths like "Provider absent", "User rejection", and "Chain mismatch". However, as documented in `wallet.ts`, this module is purely a mock / stand-in that stores a deterministic fake address in `localStorage`.

Since the module does not integrate with any real wallet provider (like Freighter), these assumed error paths and listeners **do not exist** in `wallet.ts`. I have reported these "untested paths" as `.todo()` in the test suite to formally acknowledge them as defects (i.e. the promised feature doesn't exist).

I have written tests for the actual exposed methods, verifying:
- Successful saving, loading, and clearing of accounts from `localStorage`
- The `loadAccount` error paths (invalid JSON, missing address, regex validation failure)
- Address truncation formatting
- Deterministic seed generation in `mockAddress`

---------

Co-authored-by: daveedAJ <davidadegoke055@gmail.com>
Co-authored-by: Jagadeeshftw <92681651+Jagadeeshftw@users.noreply.github.com>
Co-authored-by: Opulence Chuks <162402876+Opulencechuks@users.noreply.github.com>
Co-authored-by: Annie <168873935+AnnieIj@users.noreply.github.com>
Co-authored-by: Codebuff <noreply@codebuff.com>
Co-authored-by: Luis Carlos Fuentes De Avila <125478683+Flames4fun@users.noreply.github.com>
Co-authored-by: ugoocreates-pixel <ugoocreates@gmail.com>
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.

The application has no accessibility testing of any kind — no axe integration, no a11y specs, no jsx-a11y lint rules

2 participants