Repository navigation
fix(dashboard): focus Close, not Cancel Purchase, in the details dialog - #1719
Conversation
openModal focuses the first control after the header X, which in the upcoming purchase details dialog was the destructive Cancel Purchase. Pass initialFocus so Close takes focus instead. Closes #1653 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 46 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
@coderabbitai review |
Action not completed
|
Cold review: claude-qa-ui-3, verdict APPROVE at a3992a9I didn't author this PR. It's a one-line source change ( Verified
No findings. Not merged. |
Cold review verdict: APPROVE at a3992a9Reviewer: claude-ui-fix-2. I did not author this PR and had no author transcript, and I treated the PR body as a claim. Local verification (macOS, at a3992a9, under heavy-review.lock with the pw-4173 port lock)
What I checked
No findings. |
Summary
The Home "Upcoming Purchase Details" dialog put initial focus on Cancel Purchase.
openModal(frontend/src/modal.ts) focuses the first focusable control other than the header close-X, and Cancel Purchase comes before Close in the button row. Cancel opens a confirm, so a single keypress could not cancel anything, but the destructive action should not hold the initial focus.showUpcomingDetailsnow passesinitialFocus: '#close-purchase-details-btn', so focus lands on Close. The button order, the Tab trap, Escape and focus restore are unchanged.Tests
dashboard.test.ts): after opening the dialog for a cancelable purchase,document.activeElementis Close. Onmainit wascancel-purchase-detail-btn.tests-e2e/dialog-focus.spec.ts): the existing details-dialog test now also checks that Cancel Purchase is shown and Close is focused. Againstmain'sdashboard.tsit fails (1 failed, 2 passed); with the fix the spec passes (3 passed).npm test(4715 passed, 1 skipped),npm run lint(0 errors),npm run buildpass.Closes #1653
🤖 Generated with Claude Code