-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Describe the problem
I had a follow-up thought about #6914. In cases where people are using SvelteKit to generate embeds that sit in a larger application, it's necessary to come up with elaborate workarounds to prevent clicks in the main app nav (for example) being handled by SvelteKit's router.
If we instead only listened for click events coming from inside the part of the app SvelteKit controls, it would be very easy to embed SvelteKit apps elsewhere.
Describe the proposed solution
I'm pretty sure we would just need to replace
kit/packages/kit/src/runtime/client/client.js
Line 1393 in 93712f0
addEventListener('click', (event) => { |
addEventListener(...)
with target.addEventListener(...)
.
The only downside I can see is that links inside src/app.html
outside %sveltekit.body%
wouldn't trigger the client-side router, but a) you can work around it if you really need to with goto
, and b) i would be astonished if anyone was doing that. Technically a breaking change, of course, so we should do this quickly if we intend to do it at all.
Alternatives considered
No response
Importance
nice to have
Additional Information
No response