waveterm icon indicating copy to clipboard operation
waveterm copied to clipboard

Add confirmation dialog before closing tabs

Open stevenvo opened this issue 2 months ago • 1 comments

Summary

Prevents accidental tab closures by showing a confirmation modal.

Problem

Users can accidentally close tabs by clicking the X button, losing their work and terminal session.

Solution

  • Shows confirmation modal: "Close Tab? This action cannot be undone"
  • Modal appears when:
    • Clicking X button on tab
    • Selecting 'Close Tab' from context menu
  • User can confirm (OK) or cancel

Implementation

  • New ConfirmCloseTabModal component
  • Registered in modal registry
  • Modified handleCloseTab in tabbar to show modal
  • Preserves existing close behavior after confirmation

Test Plan

  • [x] Click X on tab -> modal appears
  • [x] Right-click -> Close Tab -> modal appears
  • [x] Click OK -> tab closes
  • [x] Click Cancel -> tab stays open
  • [x] Press Escape -> modal closes, tab stays

🤖 Generated with Claude Code

stevenvo avatar Dec 15 '25 04:12 stevenvo

[!WARNING]

Rate limit exceeded

@stevenvo has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 21 minutes and 41 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 837fc8616f35e702c27d97d9c8af99bd71cae8b1 and e64f9bf166bb704e46f2d3ba1def5b4b57713920.

📒 Files selected for processing (4)
  • frontend/app/modals/confirmclosetab.tsx
  • frontend/app/modals/modalregistry.tsx
  • frontend/app/store/keymodel.ts
  • frontend/app/tab/tabbar.tsx

Walkthrough

This pull request introduces a confirmation dialog for closing tabs. A new ConfirmCloseTabModal component is created that displays a confirmation message and handles tab closure upon user confirmation. The modal is registered in the modal registry and integrated into the tab bar's close handler, replacing the immediate close action with a confirmation step.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • The changes follow established patterns (modal confirmation flow, registry integration)
  • Logic is straightforward with standard React component structure
  • Three related files with clear, single-purpose modifications
  • Primary concerns for review:
    • Verify the tab closure logic in ConfirmCloseTabModal matches the original implementation from tabbar.tsx
    • Confirm proper data flow of tabId through the modal chain
    • Ensure modal registry key and display name consistency

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add confirmation dialog before closing tabs' accurately reflects the main change: introducing a confirmation modal to prevent accidental tab closures.
Description check ✅ Passed The description is well-related to the changeset, clearly outlining the problem, solution, implementation details, and test plan for the confirmation dialog feature.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Dec 15 '25 04:12 coderabbitai[bot]