fix: fix session deleted before confirm#7
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes an issue where deleting a saved session could occur immediately (making confirmation ineffective on Windows) by replacing the native confirm() flow with an in-app confirmation overlay.
Changes:
- Introduces a
pendingDeleteSessionIdstate to gate deletion behind explicit user confirmation. - Replaces the
confirm('Delete this session?')call with a custom modal-style overlay and confirm/cancel actions. - Updates click handling to prevent delete clicks from triggering session resume.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <div class="delete-dialog"> | ||
| <h4>Delete this session?</h4> | ||
| <p>This only removes it from the saved session list.</p> |
There was a problem hiding this comment.
The delete confirmation dialog doesn’t indicate which session is being deleted (e.g., title/agent). Once the overlay is open the list is visually obscured, which makes it easier to confirm the wrong deletion. Consider looking up the pending session from sessions (by id) and displaying its title/agent in the dialog text, or store the session object when prompting delete.
| <div | ||
| v-if="pendingDeleteSessionId" | ||
| class="delete-overlay" | ||
| @click.self="cancelDelete" | ||
| > | ||
| <div class="delete-dialog"> | ||
| <h4>Delete this session?</h4> | ||
| <p>This only removes it from the saved session list.</p> | ||
| <div class="delete-actions"> | ||
| <button type="button" class="cancel-btn" @click="cancelDelete"> | ||
| Cancel | ||
| </button> | ||
| <button type="button" class="confirm-btn" @click="confirmDelete"> |
There was a problem hiding this comment.
The overlay behaves like a modal, but there’s no keyboard handling (e.g., Escape to cancel) and no focus management, so keyboard users can still tab to elements behind the overlay. Consider adding an Escape handler while the dialog is open and moving initial focus into the dialog (and ideally trapping focus) to make this a true, accessible confirmation modal.
On Windows, clicking the “Delete Session” button currently deletes the session immediately while simultaneously displaying the confirmation dialog—rendering the confirmation dialog ineffective. This PR fixes that issue.