-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Describe the bugs
I've grouped together two behavioural issues as they feel related:
-
Links that open in a new tab / window should not trigger beforeNavigate.
-
It would be useful to be notified whether
navigation.cancel()will trigger the browserbeforeunloadbehaviour.
Or, if we could choose whether to trigger that behaviour.
As it stands it's not possible to know whether to handle the beforeUnload event with our own UI. In my first (naive) use ofnavigation.cancel(), I created my own confirmation UI in Svelte. The final result was that some navigation events would have just my UI, and others would have the native UI and my UI.
Reproduction
https://github.com/oodavid/sveltekit-beforeUnload/tree/2af0ef6271242397da1491f74608750f7c28e886 - repo (note that this is pointing at a specific commit!)
https://www.loom.com/share/3fbc000bbbaa4e65b1e64f304d0fddee - video explanation
Logs
No response
System Info
System:
OS: macOS 12.3.1
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 32.05 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.18.1 - ~/.nvm/versions/node/v16.18.1/bin/node
npm: 8.19.2 - ~/.nvm/versions/node/v16.18.1/bin/npm
Browsers:
Chrome: 108.0.5359.124
Edge: 108.0.1462.76
Firefox: 105.0.1
Safari: 15.4
npmPackages:
@sveltejs/adapter-auto: ^1.0.0 => 1.0.0
@sveltejs/kit: ^1.0.0 => 1.0.11
svelte: ^3.54.0 => 3.55.1
vite: ^4.0.0 => 4.0.4Severity
annoyance
Additional Information
No response