feat(frontend): 2FA optimistic rollback, keyboard nav, tests, and accessible Analytics Cards focus trap - #1583
Open
omarima-10 wants to merge 1 commit into
Open
omarima-10 wants to merge 1 commit into
omarima-10 wants to merge 1 commit into
Conversation
…ble focus trap - TwoFactorAuthSetup: preserve QR/manual key and entered code on a network failure during verification instead of discarding setup progress, add a retry action, and distinguish network failures from invalid-code rejections (closes emdevelopa#1519) - TwoFactorAuthSetup: submit on Enter, clear on Escape, and announce step transitions via a live region for keyboard/screen-reader users (closes emdevelopa#1520) - TwoFactorAuthSetup: add unit and snapshot test coverage across all steps, including the new rollback/retry and keyboard behavior; fix a pre-existing deadlock where waitFor was awaited while fake timers were active (closes emdevelopa#1521) - AnalyticsCards: make each card an interactive detail dialog reusing the shared Modal component; fix Modal's focus trap, which was silently inert because its ref was never attached to the dialog element, and add the missing role="dialog"/aria-modal/aria-labelledby (closes emdevelopa#1522)
|
@omarima-10 is attempting to deploy a commit to the Emmanuel's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@omarima-10 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! 🚀 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
waitFor(...)while fake timers were active, which deadlocks becausewaitForpolls viasetTimeout, frozen oncevi.useFakeTimers()runs, until Vitest's own test timeout. Fixed by following this repo's own established pattern elsewhere (e.g.KycSubmissionForm.test.tsx): flush state synchronously viaact(async () => vi.runAllTimers())and assert directly, nowaitForunder fake timers.ui/Modalcomponent) with the metric restated in plain language. While wiring this up I found the sharedModalcomponent's focus trap was silently inert:dialogRefwas declared and read in the trap'suseEffect, but never attached viaref={}to any element, sodialogRef.currentwas alwaysnulland the trap's own early-return made it a no-op on every open. Fixed by attaching the ref and adding the missingrole="dialog",aria-modal="true", andaria-labelledby(matching the conventionPaymentDetailModal.tsxalready uses), so the focus trap is now real for every consumer of the sharedModal, not justAnalyticsCards.Test plan
TwoFactorAuthSetup.test.tsx: 31/31 pass (26 pre-existing, rewritten to fix the fake-timer deadlock, plus 5 new snapshots)AnalyticsCards.test.tsx(new): 11/11 pass, including focus-trap and dialog-labelling assertionsFiatOnrampModal.test.tsx(existing consumer of the sharedModal): 7/7 pass, confirming theModalARIA/ref fix is non-breakingnpx tsc --noEmit: identical pre-existing error count to a cleanmainbaseline (6 errors, all inOnboardingProgressTracker.tsx, unrelated)npx vitest run: verified suite-by-suite against a cleanmainbaseline, zero new failures;TwoFactorAuthSetup.test.tsxmoved from failing to fully passingcloses #1519
closes #1520
closes #1521
closes #1522