Skip to content

Give user alert to confirm browser refresh #2196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

karthick-murugan
Copy link
Contributor

@karthick-murugan karthick-murugan commented Apr 22, 2025

Fixes #81

This PR addresses #81 – Give user alert to confirm browser refresh by adding a browser-level confirmation dialog that triggers when a user attempts to refresh or close the Playground window/tab. This helps prevent accidental data loss or session interruption due to unintended refreshes.

Changes Introduced

  • Added a beforeunload event listener to the Playground UI.
  • The event prompts a native browser confirmation dialog, asking the user to confirm if they really want to refresh or navigate away from the page.
  • Ensures smoother UX by reducing unintentional disruptions during usage.

🧪 Testing Instructions

  • Start the Playground.
  • Interact with any UI component to simulate an active session.
  • Try refreshing the page or closing the browser tab.
  • A browser-native alert will now ask for confirmation.

Sceenshot

confirm_alert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Inbox
Development

Successfully merging this pull request may close these issues.

Give user alert to confirm browser refresh
1 participant