Skip to content

Implement Browser Reload Warning to Prevent Accidental Data Loss​ #2192

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

Closed
tyrann0us opened this issue Apr 17, 2025 · 1 comment
Closed

Comments

@tyrann0us
Copy link
Contributor

Description:

When using WordPress Playground, it's easy to accidentally reload the browser (e.g., by accidentally pressing cmd + R instead of cmd + T), leading to the loss of all unsaved changes and the initiation of a new Playground session. This can be particularly frustrating for users who are not aware that their work will be discarded upon (accidental) reload.​

Proposed Solution:

Implement a browser reload warning that triggers when a user attempts to reload the page. This warning should inform the user that any unsaved changes will be lost and provide options to either proceed with the reload or cancel the action.​

Suggested Implementation:

Utilize the beforeunload event in JavaScript to detect reload attempts and display a confirmation dialog to the user.

@karthick-murugan
Copy link
Contributor

Hi @tyrann0us,

This issue has already been reported in #81, and I’ve submitted a PR today to address it.

Just wanted to bring it to your attention for reference.

Thanks!

@github-project-automation github-project-automation bot moved this from Inbox to Done in Playground Board Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants