Skip to content

fix: show confirm dialog on closing upload tab#59324

Open
mykh-hailo wants to merge 3 commits into
nextcloud:masterfrom
mykh-hailo:fix/upload-close-confirmation
Open

fix: show confirm dialog on closing upload tab#59324
mykh-hailo wants to merge 3 commits into
nextcloud:masterfrom
mykh-hailo:fix/upload-close-confirmation

Conversation

@mykh-hailo
Copy link
Copy Markdown
Contributor

@mykh-hailo mykh-hailo commented Mar 31, 2026

Summary

This PR adds a beforeunload safeguard to prevent users from accidentally closing or navigating away from the page while uploads are still active.

A new upload guard service is introduced in apps/files/src/services/UploadBeforeUnload.ts and registered in both:

  • apps/files/src/main.ts (regular Files app)
  • apps/files_sharing/src/init-public.ts (public sharing/file drop flow)

When the uploader status is not idle (including uploading or paused), the browser is prompted with a warning that leaving the page will cancel ongoing uploads. The listener is registered only once to avoid duplicate handlers.

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@mykh-hailo mykh-hailo requested review from a team and skjnldsv as code owners March 31, 2026 02:05
@mykh-hailo mykh-hailo requested review from nfebe and sorbaugh and removed request for a team March 31, 2026 02:05
@mykh-hailo mykh-hailo force-pushed the fix/upload-close-confirmation branch from 564bbab to c2e253b Compare March 31, 2026 02:12
Copy link
Copy Markdown
Member

@skjnldsv skjnldsv left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @mykh-hailo, let's discuss this

@susnux better to have this as a core uploader feature, no ?

@skjnldsv skjnldsv added enhancement 2. developing Work in progress feature: files papercut Annoying recurring UX issue with possibly simple fix. labels Mar 31, 2026
@mykh-hailo
Copy link
Copy Markdown
Contributor Author

@susnux Could you possibly share your idea about this PR and @skjnldsv 's comment?

@susnux
Copy link
Copy Markdown
Contributor

susnux commented Apr 2, 2026

better to have this as a core uploader feature, no ?

Yes I think this should be part of the Uploader Vue component (but not of the uploader API class).

@skjnldsv
Copy link
Copy Markdown
Member

skjnldsv commented Apr 3, 2026

@mykh-hailo we use a shared component for uploading.
This is located here https://github.com/nextcloud-libraries/nextcloud-upload/tree/main/lib/vue/components

I think it should be a shared feature, so anyone using the upload component benefit from this ! 👍

Signed-off-by: mykh-hailo <kristianderonta0205@gmail.com>
Signed-off-by: mykh-hailo <kristianderonta0205@gmail.com>
Signed-off-by: mykh-hailo <kristianderonta0205@gmail.com>
@mykh-hailo mykh-hailo force-pushed the fix/upload-close-confirmation branch from c2e253b to 77ef618 Compare April 9, 2026 09:38
@mykh-hailo mykh-hailo closed this Apr 9, 2026
@mykh-hailo mykh-hailo reopened this Apr 9, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress bug enhancement feature: files feedback-requested papercut Annoying recurring UX issue with possibly simple fix.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Closing Tab stops upload without confirmation request.

4 participants