-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
beforeNavigate shouldn't trigger when <a target="_blank"> #8482
Comments
Thanks for the thorough reproduction and the video! beforeNavigate firing for links opening in a new tab is definitely a bug. Navigation links not triggering an |
Also some docs on how to know when native confirmation dialog appears fixes #8482
* fix: ignore target=_blank links Also some docs on how to know when native confirmation dialog appears fixes #8482 * handle iframe case * handle custom targets, simplify * Update packages/kit/src/runtime/client/client.js * Update packages/kit/types/ambient.d.ts Co-authored-by: Rich Harris <[email protected]> Co-authored-by: Rich Harris <[email protected]>
Hi, I actually really want this to work for |
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 browserbeforeunload
behaviour.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 of
navigation.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
Severity
annoyance
Additional Information
No response
The text was updated successfully, but these errors were encountered: