Add confirmation dialog before closing host lobby modal 🔧#3364
Add confirmation dialog before closing host lobby modal 🔧#3364
Conversation
Show a confirm prompt when the user tries to close the host lobby via click-outside or Escape key, preventing accidental lobby exits. - Add confirmBeforeClose() guard to BaseModal (Escape key) - Check confirmBeforeClose() in Navigation.ts (click-outside) - Override in HostLobbyModal with translated confirmation message - Add leave_confirmation translation key
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughAdds a close-confirmation lifecycle hook and its use: BaseModal gains Changes
Sequence DiagramsequenceDiagram
actor User
participant Nav as Navigation
participant Modal as HostLobbyModal
participant Trans as Translation
User->>Nav: Click to navigate away / main-area click
Nav->>Modal: call confirmBeforeClose()
Modal->>Trans: translateText("host_modal.leave_confirmation")
Trans-->>Modal: returns localized string
Modal->>User: show confirm(dialog)
User-->>Modal: confirm OK or Cancel
Modal-->>Nav: returns true or false
alt confirmed (true)
Nav->>Modal: proceed with close
Modal->>Nav: close and cleanup
else cancelled (false)
Nav->>Nav: abort close, keep modal open
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/client/components/BaseModal.ts`:
- Around line 99-106: The onClose callback registered in firstUpdated()
currently calls BaseModal.close() directly and thus bypasses the
confirmBeforeClose() guard used for Escape key handling; update the onClose
handler (the callback passed to the o-modal component in firstUpdated()) to call
confirmBeforeClose() first and only invoke BaseModal.close() when
confirmBeforeClose() returns true (return false / skip calling close() when the
guard returns false) so backdrop clicks respect the same confirmation logic as
Escape key presses.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 71e3a42d-0def-4806-9f93-5bf62071e099
📒 Files selected for processing (4)
resources/lang/en.jsonsrc/client/HostLobbyModal.tssrc/client/Navigation.tssrc/client/components/BaseModal.ts
Description:
Show a confirm prompt when the user tries to close the host lobby via click-outside or Escape key, preventing accidental lobby exits. Happened to many people and also DougDoug...
Does not show the prompt when the user clicks the arrow button because it's probably intentional.
Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
FloPinguin