Skip to content

test(#722): guard keyboard accessibility of the sell key modal - #741

Merged
Chucks1093 merged 1 commit into
accesslayerorg:devfrom
OpensrcLord:test/722-sell-key-modal-keyboard-accessibility
Aug 1, 2026
Merged

test(#722): guard keyboard accessibility of the sell key modal#741
Chucks1093 merged 1 commit into
accesslayerorg:devfrom
OpensrcLord:test/722-sell-key-modal-keyboard-accessibility

Conversation

@OpensrcLord

Copy link
Copy Markdown
Contributor

Summary

Fixes #722

The sell key modal (TradeDialog, shared by the buy and sell flows) is opened from LandingPage via external open/onOpenChange props rather than Radix's own <DialogTrigger>. Keyboard accessibility was implemented for the buy modal in #700 (initial focus on the quantity input, focus trapping, Escape-to-close, Enter/Space activation of Confirm, and focus return to the actual trigger). Since TradeDialog is a single shared component, the sell modal already inherits that behavior — but no tests guarded the sell variant, so a regression in the shared wiring would go unnoticed.

This PR adds coverage that verifies all five acceptance criteria from #722 hold for the sell modal:

  • Focus trapped inside the modal while open (Tab from Confirm cycles back in, never to the page behind)
  • Initial focus lands on the quantity input when the modal opens
  • Escape closes the modal
  • Confirm button reachable via Tab and activatable via Enter/Space
  • Focus returned to the trigger button on close (both Escape and Cancel)

Changes

  • src/components/common/__tests__/TradeDialog.a11y.test.tsx — parameterized the trigger helper by side and added a sell key modal keyboard accessibility (#722) block with 8 tests covering every acceptance criterion against the real controls.
  • src/pages/__tests__/LandingPage.sellFlow.integration.test.tsx — added an end-to-end test that opens the real sell modal from the actual Sell button, asserts focus lands on the amount input, closes with Escape, and asserts focus returns to the Sell button.

Verification

  • TradeDialog.a11y.test.tsx: 17/17 pass (9 buy + 8 sell)
  • LandingPage.sellFlow.integration.test.tsx: 4/4 pass
  • eslint and tsc -b --noEmit clean on changed files

Pre-existing failures on dev in LandingPage.sellConfirmationModal.integration.test.tsx and TradeDialog.focusOrder.test.tsx (stale networkFeeEstimateProvider prop tests) are unrelated to this change and were confirmed failing before it.

… sell key modal

TradeDialog is shared between the buy and sell flows; accesslayerorg#700 already
implemented and tested keyboard accessibility for the buy modal
(initial focus on the amount input, focus trapping, Escape-to-close,
Enter/Space activation of Confirm, focus return to the trigger). The
sell variant shares that implementation but had no coverage guarding it.

Add a sell-variant block to the TradeDialog a11y suite that verifies all
five acceptance criteria from accesslayerorg#722 against the real controls, plus an
end-to-end LandingPage test proving the actual Sell button regains focus
after the modal closes with Escape.
@drips-wave

drips-wave Bot commented Jul 31, 2026

Copy link
Copy Markdown

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

@Chucks1093
Chucks1093 merged commit 1f75648 into accesslayerorg:dev Aug 1, 2026
1 check 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.

Add keyboard accessibility to the sell key modal so all actions are reachable without a mouse

3 participants