Skip to content

feat: add useTransactionFilters hook, improve sidebar a11y, and refactor multisig state#1000

Merged
emdevelopa merged 1 commit into
emdevelopa:mainfrom
boys-cyberhub:feat/issues-939-940-941-942
Jun 25, 2026
Merged

feat: add useTransactionFilters hook, improve sidebar a11y, and refactor multisig state#1000
emdevelopa merged 1 commit into
emdevelopa:mainfrom
boys-cyberhub:feat/issues-939-940-941-942

Conversation

@boys-cyberhub

Copy link
Copy Markdown
Contributor

Closes #939
Closes #940
Closes #941
Closes #942

What changed

#941 — useTransactionFilters hook with optimistic updates (frontend/src/hooks/useTransactionFilters.ts)

  • Implemented the missing hook (the file previously contained test code; this replaces it with the actual implementation)
  • Uses useReducer + paymentHistoryFiltersReducer so draft filter state updates synchronously on every interaction — no waiting for URL sync
  • Search: debounced 350 ms before pushing to URL; searchSyncPending stays true in the meantime so callers can show a syncing indicator without blocking the input
  • Non-search filters: pushed inside a React useTransition; isFilterPending exposes the transition state
  • Debounce is cancelled on onClearFilter("search") and onClearAll so no stale push fires after clearing
  • hasActiveFilters reflects the optimistic draft state immediately

#940 — Screen reader improvements (frontend/src/components/TransactionFilterSidebar.tsx)

  • Desktop sticky panel: added role="complementary" and aria-label="Transaction filters" so it is a named landmark for AT users
  • SyncSpinner wrapper inside active asset buttons: added aria-hidden="true" so the spinner text ("Syncing…") is excluded from the button's computed accessible name
  • Clear All button: aria-label now includes the active filter count, e.g. "Clear all 2 active filters"
  • Added a role="status" / aria-live="polite" / aria-atomic="true" region in the header that announces count changes to screen readers (e.g. "2 filters active" → "1 filter active")

#941 — Optimistic active-filter count badge (frontend/src/components/TransactionFilterSidebar.tsx)

  • Count badge (aria-hidden) in the header shows the number of active filter dimensions and updates before URL sync (driven by the optimistic filters prop, not the committed URL state)

#939 — Extended unit tests (frontend/src/components/TransactionFilterSidebar.test.tsx)

  • Added section 7 · Screen reader & optimistic updates (13 new test cases) covering:
    • Desktop panel landmark role and label
    • aria-hidden on SyncSpinner wrapper inside asset buttons
    • Count badge absent / singular / multi-filter
    • Live region empty when no filters, singular/plural announcement text
    • Clear All aria-label with count vs. generic label
    • Mobile dialog retaining its role="dialog" and aria-modal attributes

#942 — MultisigProvider refactored to useReducer (frontend/src/lib/multisig-context.tsx)

  • Replaced 6 separate useState calls with a single useReducer + multisigReducer
  • Action types: SET_TRANSACTION, SET_STEP, SET_LOADING, SET_ERROR, CLEAR_ERROR, RESET, SET_VISIBLE, OPTIMISTIC_SIGN, CONFIRM_SIGN, REVERT_SIGN, SUBMIT_SUCCESS
  • OPTIMISTIC_SIGN sets hasSigned: true immediately (before async); CONFIRM_SIGN atomically attaches the real signature and auto-advances to the "submit" step if the weight threshold is met
  • signTransaction and submitTransaction use a stateRef (always-current snapshot) to avoid stale-closure issues without needing the state in their dependency arrays
  • All public APIs unchanged: useMultisig(), useMultisigState(), useMultisigActions(); all existing tests in multisig-optimistic.test.tsx continue to pass

How to test

cd frontend
npm run test -- TransactionFilterSidebar
npm run test -- useTransactionFilters
npm run test -- multisig-optimistic
  • Verify the desktop sidebar has a complementary landmark in browser accessibility tree (DevTools → Accessibility pane)
  • Verify active filter count badge updates instantly (no URL round-trip delay) when toggling filters
  • Verify screen reader announces count changes as filters are applied/cleared

…ilterSidebar and MultisigApprovalModal

emdevelopa#941 — Add useTransactionFilters hook with optimistic UI updates: draft filter state
updates synchronously on every interaction while URL sync is deferred (search debounced
350 ms, other filters wrapped in a React transition with isFilterPending flag).

emdevelopa#940 — Improve screen reader support in TransactionFilterSidebar: desktop panel gets
role="complementary" and aria-label="Transaction filters"; SyncSpinner wrapper inside
asset buttons gains aria-hidden="true" to keep button accessible names clean; Clear All
button gets an aria-label reflecting the active filter count.

emdevelopa#941 — Add optimistic active-filter count badge in the sidebar header that updates
immediately (before URL sync) and a polite aria-live region that announces count changes
to screen readers.

emdevelopa#939 — Extend TransactionFilterSidebar unit tests (section 7) to cover the new landmark
role, count badge, live region text, aria-hidden spinner wrapper, and Clear All label.

emdevelopa#942 — Refactor MultisigProvider from 6 separate useState calls to a single useReducer
with explicit action types (OPTIMISTIC_SIGN, CONFIRM_SIGN, REVERT_SIGN, SUBMIT_SUCCESS,
etc.). Preserves all public hook APIs and the optimistic signing behaviour tested in
multisig-optimistic.test.tsx.

Closes emdevelopa#939
Closes emdevelopa#940
Closes emdevelopa#941
Closes emdevelopa#942
@vercel

vercel Bot commented Jun 24, 2026

Copy link
Copy Markdown

@boys-cyberhub is attempting to deploy a commit to the Emmanuel's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jun 24, 2026

Copy link
Copy Markdown

@boys-cyberhub Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@emdevelopa emdevelopa merged commit eaa5c9d into emdevelopa:main Jun 25, 2026
1 of 5 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

2 participants