GenericDialog registers an unload listener that has no effect
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 66/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- typescript
- Domain
- frontend
Research direction
Read lib/components/GenericDialog.vue and trace the dialog lifecycle hooks that register and remove the unload listener. Decide whether the dialog should warn before navigation or whether the listener should be removed; the issue offers both options. Done means the ineffective listener and its unload policy violation are addressed, with behavior consistent while a dialog is open.
Written by the indexing model from the issue text.
Description
Description
Moved from nextcloud/server#65093 (issues can't be transferred between organizations).
lib/components/GenericDialog.vue registers an unload listener while a generic dialog (e.g. getDialogBuilder() / the delete confirmation in Files) is open:
const handleUnload = () => `${props.name}: ${props.text}`
onMounted(() => window.addEventListener('unload', handleUnload))
onUnmounted(() => window.removeEventListener('unload', handleUnload))
The return value of an unload handler is ignored, so the listener has no effect. Chrome is phasing out unload and blocks it by default on more and more sites, which logs a violation every time such a dialog is opened:
[Violation] Permissions policy violation: unload is not allowed in this document.
It was probably meant to be a beforeunload handler that warns before leaving the page while a dialog is open.
Suggestion
Either switch to beforeunload with event.preventDefault() (if the warning is wanted) or remove the listener.
Reported for @nextcloud/dialogs 7.5.0 as used by Nextcloud 35; still present on main.
- Dominant language
- TypeScript
- Stars
- 19
- Forks
- 10
- Avg merge
- 17h 4m
- Merged PRs (30d)
- 30
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nextcloud-libraries/nextcloud-dialogs
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
nextcloud-libraries/nextcloud-dialogs#2771 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
nextcloud-libraries/nextcloud-dialogs#2770 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
nextcloud-libraries/nextcloud-dialogs#2756 · 1 reaction ·
Maintainers usually reply within 1 day
-
Actions on ToastsOpen1. to develop
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
nextcloud-libraries/nextcloud-dialogs#2669 · 1 comment ·
Maintainers usually reply within 1 day
-
1. to develop
Difficulty 4/5 3-5 days Newbie friendliness 48/100
nextcloud-libraries/nextcloud-dialogs#2510 · 2 comments ·
Maintainers usually reply within 1 day
All issues in nextcloud-libraries/nextcloud-dialogs
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Make the "%" unit spacing the same in the web and in A10Possibly taken @kragent66-glitch claimed this today. Openbug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
maiychrus25/OpenTea-DX-OS#226 · 1 comment ·
-
Editor: leave an uploaded or inserted image's alt text empty, so the preview asks for a descriptionOpen
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 65/100
sveltejs/svelte.dev#2417 ·
Maintainers usually reply within 1 day
-
[Bug]: A Markdown link with both a :line suffix and a #L fragment opens a path containing ":line"Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day