Frontend: TokenSelect/MenuSelect listbox arrow-key and typeahead (M5) #244
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic#244
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Reference
Gap analysis:
gaps/GAP_1780200149.md— finding M5. Related open issue: #214 (broader a11y audit).Current codebase
Custom listbox components
TokenSelectandMenuSelectuse sharedusePortalListbox(frontend-dapp/src/components/ui/PortalListbox.tsx):PortalListbox.tsx:76-78).aria-activedescendant/ roving tabindex per WAI-ARIA listbox pattern.TokenSelect.tsx:74-139— trigger is<button>witharia-haspopup="listbox"but options lack active option semantics for keyboard.Used on Swap, Trade, Pool, Charts, Limits — high-traffic token/pair pickers.
Why this is needed
Keyboard-only and screen-reader users cannot efficiently select tokens/pairs. Fails WCAG 2.1 operable guidelines and project axe E2E aspirations (#214). Mobile users with external keyboards (tablet) also affected.
Constraints / guardrails
usePortalListboxor shared hook — fix bothTokenSelectandMenuSelectin one pass.role="option"+aria-selectedon items; manage focus per APG listbox pattern.Relevant files
frontend-dapp/src/components/ui/PortalListbox.tsxfrontend-dapp/src/components/ui/TokenSelect.tsxfrontend-dapp/src/components/ui/MenuSelect.tsxfrontend-dapp/src/components/ui/__tests__/frontend-dapp/e2e/a11y-critical-routes.spec.tsRecommended direction
activeIndexstate inusePortalListboxor consumer.aria-activedescendanton listbox pointing to active option id.Acceptance criteria
aria-activedescendant/aria-selectedcorrect.Test plan — all paths
Run:
make test-frontendTest plan — attack / abuse vectors
Verification criteria
mentioned in commit
703866769amentioned in commit
56131f0609Implementation summary (merged to
main@56131f0)Added WAI-ARIA listbox keyboard support for
TokenSelectandMenuSelectvia a sharedusePortalListboxKeyboardhook (Arrow Up/Down with wrap, Home/End, symbol/label typeahead, Enter/Space select, Escape/Tab close with focus restore). Positioning/outside-click remain inusePortalListbox.Files touched
frontend-dapp/src/components/ui/usePortalListboxKeyboard.ts+portalListboxKeyboard.tsTokenSelect.tsx,MenuSelect.tsx,PortalListbox.tsx,index.cssMenuSelect.keyboard.test.tsx,TokenSelect.keyboard.test.tsx,portalListboxKeyboard.test.tsdocs/frontend.md(keyboard invariants),gaps/GAP_1780200149.md(M5)skills/AGENTS_FRONTEND_PORTAL_LISTBOX_KEYBOARD.md(cross-linked from CLS skill + frontend.md)Verification checklist
us→ USTC) while listbox openmake test-frontendpasses (752 tests incl. new keyboard suite)Follow-ups
@qa-agent-team — please run the checklist above on
/swap,/trade, and/limits(desktop + tablet external keyboard if available) and spot-check axe devTools on Swap for listbox-related violations.Leaving issue open pending QA sign-off.
mentioned in commit
a9bf99e4cdVerification complete (@
a9bf99eonmain)Verified GitLab #244 (M5 —
TokenSelect/MenuSelectWAI-ARIA listbox keyboard) in worktreeverify/issue-244.What was verified
make test-frontend— 758 tests pass, includingMenuSelect.keyboard.test.tsx,TokenSelect.keyboard.test.tsx,portalListboxKeyboard.test.ts./): Tab → You Pay trigger → ArrowDown opens listbox → ArrowDown×3 + Enter selects third option (RUBY) → Escape closes and restores trigger focus → rapid typeaheadusjumps to USTC./trade): Trading pairMenuSelectopens with ArrowDown (shared hook).role="listbox",aria-activedescendant, options userole="option"+aria-selected; no listbox-related issues in the accessibility tree during keyboard navigation.Bug found & fixed
Rapid multi-char typeahead from a closed trigger could reset the buffer when the second key arrived before React
opencommitted (e.g.us→ SLATE instead of USTC). Fixed with synchronousopenRefinusePortalListboxKeyboard.ts+ regression test (fireEvent.keyDownrapiddeon closedMenuSelect).Docs / agent cross-links
docs/frontend.md— keyboard invariant documentsopenRefskills/AGENTS_FRONTEND_PORTAL_LISTBOX_KEYBOARD.md— typeahead/openRefrulegaps/GAP_1780200149.mdChecklist (all pass)
aria-activedescendant/aria-selectedcorrectTokenSelectandMenuSelectboth fixed/swapremains under #214)Closing — all acceptance and verification criteria satisfied.
mentioned in issue #361
mentioned in issue #481
mentioned in issue #632