Skip to content

feat(a11y): fix focus trap in connect-wallet modal#477

Open
Fury03 wants to merge 2 commits into
CredenceOrg:mainfrom
Fury03:a11y/378-connect-wallet-modal
Open

feat(a11y): fix focus trap in connect-wallet modal#477
Fury03 wants to merge 2 commits into
CredenceOrg:mainfrom
Fury03:a11y/378-connect-wallet-modal

Conversation

@Fury03

@Fury03 Fury03 commented Jun 29, 2026

Copy link
Copy Markdown

Summary

  • Create ConnectWalletModal — a portal-rendered dialog with useFocusTrap (Tab/Shift+Tab wrapping, Escape, initial focus on Cancel, return focus to trigger on close), body scroll lock, and entrance animations disabled under prefers-reduced-motion: reduce
  • Wire the modal into Bond.tsx and BondDetail.tsx, replacing all bare connect() calls so every wallet-connection entry point is announced as role="dialog" with aria-modal="true"
  • Trigger buttons carry aria-haspopup="dialog"; returnFocusRef restores focus to the exact trigger element that opened the modal
  • Add 24-test suite covering rendering, error states (not_installed, rejected, generic), connecting state, all close paths (Cancel, backdrop, Escape), auto-close on wallet connect, body scroll lock, and focus restoration

Test plan

  • node_modules/.bin/vitest run src/components/ConnectWalletModal.test.tsx — 24 passed
  • node_modules/.bin/vitest run src/pages/BondDetail.test.tsx — 10 passed
  • No new TypeScript errors in ConnectWalletModal.tsx, Bond.tsx, or BondDetail.tsx
  • Open Bond page disconnected → click "Connect wallet to continue" → modal appears, Cancel returns focus to button
  • Open BondDetail disconnected → click "Connect wallet to withdraw" → modal appears, Cancel returns focus to button
  • OS prefers-reduced-motion: reduce suppresses backdrop fade-in and panel slide-up animations

Closes #378

Fury03 added 2 commits June 29, 2026 05:04
…ts, and fixed props

- Add Storybook path and variant list for the 5 components that have
  story files (AddressInput, AmountInput, FormField, Select, Toggle)
- Add a Storybook intro blurb at the top explaining how to browse stories
- Fix ConfirmDialog props table: breakdown is optional, not required;
  add 7 previously undocumented props (description, children,
  confirmInputLabel, confirmInputHint, variant, confirmPhrase, confirmHint)
- Add 7 missing public component entries: ActionCard, Disclaimer,
  ThemeToggle, KeyboardShortcutsDialog, AttestationForm, CreateBondFlow,
  ErrorBoundary — each with props table, a11y notes, tokens, and example
- Extend styling ownership table to cover the 7 new components
- Update README.md and docs/README.md descriptions to mention stories

Closes CredenceOrg#402
Create ConnectWalletModal with WCAG 2.1 AA focus management: portal-rendered
dialog with useFocusTrap (Tab wrapping, Escape, initial focus on Cancel,
return focus on close) and body scroll lock. Entrance animations respect
prefers-reduced-motion: reduce. Wire the modal into Bond and BondDetail,
replacing bare connect() calls so the wallet flow is always announced as
a dialog. Add 24-test suite covering rendering, error states, connecting
state, closing, auto-close on connect, scroll lock, and focus restoration.

Closes CredenceOrg#378
@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@Fury03 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

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.

Fix focus trap inside the connect-wallet modal

1 participant