Skip to content
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

Fix to solve issue of leaving page during upload of images #1803

Merged
merged 3 commits into from
May 12, 2024

Conversation

Martijn-vanDijk
Copy link
Contributor

Fixes #135

Just a fix to make it not leave the page when uploading pictures to albums. (or atleast give a warning)

@tomudding tomudding self-requested a review March 26, 2024 19:57
Comment on lines +101 to +105
// Most modern browsers no longer support setting custom dialog messages
// for this dialog, but for backwards compatibility this could be nice.
const warning = "You are currently uploading files, are you sure you want to leave?";
e.returnValue = warning;
return warning;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works great! However, I suggest adding

e.preventDefault();

at the top inside the if-statement. That is the new way of actually enabling this event. The other options, setting e.returnValue and returning warning, are deprecated (imho the return warning; can be removed as e.returnValue has been supported in most major browsers since 2017 or earlier).

@tomudding tomudding merged commit e6f78bb into GEWIS:main May 12, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Photo: Show warning when leaving page during photo upload
2 participants