Description
This is a UI/UX issue covering destructive-action safety. The danger-button "Regenerate" in src/ApiUsage.tsx immediately replaces the API key via handleRegenerateApiKey with no confirmation. Since regenerating invalidates the existing key and breaks live integrations, an accidental click is costly.
Requirements and Context
- Introduce a reusable confirmation dialog (accessible:
role="dialog", focus trap, Escape to cancel) that explains the consequence before regenerating.
- Default focus to the safe "Cancel" action; require explicit confirmation to proceed.
- Reuse this dialog pattern so it can be applied to future destructive actions.
- Must be secure, tested, and documented
- Should be efficient and easy to review
Suggested Execution
- Fork the repo and create a branch
git checkout -b feature/regenerate-confirm-dialog
- Implement changes
src/components/ConfirmDialog.tsx (new) with focus trap and Escape handling
src/ApiUsage.tsx — gate handleRegenerateApiKey behind the dialog
src/index.css — token-driven dialog styling
- Test and commit
npm run dev, open /api-usage, click Regenerate and verify the confirm flow
- Include test output and notes in the PR
Example commit message
feat: add confirmation dialog for API key regeneration
Acceptance Criteria
Guidelines
- Meet WCAG 2.1 AA 3.3.4 (Error Prevention) for the destructive step
- Clear documentation and inline comments
- Timeframe: 96 hours
Description
This is a UI/UX issue covering destructive-action safety. The
danger-button"Regenerate" insrc/ApiUsage.tsximmediately replaces the API key viahandleRegenerateApiKeywith no confirmation. Since regenerating invalidates the existing key and breaks live integrations, an accidental click is costly.Requirements and Context
role="dialog", focus trap, Escape to cancel) that explains the consequence before regenerating.Suggested Execution
src/components/ConfirmDialog.tsx(new) with focus trap and Escape handlingsrc/ApiUsage.tsx— gatehandleRegenerateApiKeybehind the dialogsrc/index.css— token-driven dialog stylingnpm run dev, open/api-usage, click Regenerate and verify the confirm flowExample commit message
Acceptance Criteria
Guidelines