Skip to content
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

Page transitions don't work if <a> tag has target attribute set (even to '_self') #13162

Open
emmalexandria opened this issue Dec 15, 2024 · 1 comment · May be fixed by #13165
Open

Page transitions don't work if <a> tag has target attribute set (even to '_self') #13162

emmalexandria opened this issue Dec 15, 2024 · 1 comment · May be fixed by #13165
Labels
needs-decision Not sure if we want to do this yet, also design work needed

Comments

@emmalexandria
Copy link

emmalexandria commented Dec 15, 2024

Describe the bug

Page transitions (achieved through a simple setup in +layout.svelte:

{#key data.pathname}
  <main in:fade={{ duration: 100, delay: 200 }} out:fade={{ duration: 100 }}>
    {@render children()}
  </main>
{/key}

will trigger when an <a> tag has no target set, but will not trigger when target is set to anything except undefined (including the default value of _self)

Reproduction

https://github.com/emmalexandria/transitions-repro

Logs

No response

System Info

System:
    OS: macOS 14.5
    CPU: (8) arm64 Apple M2
    Memory: 64.84 MB / 8.00 GB
    Shell: 3.7.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 23.2.0 - ~/.local/share/nvm/v23.2.0/bin/node
    npm: 10.9.0 - ~/.local/share/nvm/v23.2.0/bin/npm
    pnpm: 9.14.2 - ~/Library/pnpm/pnpm
  Browsers:
    Chrome: 131.0.6778.140
    Safari: 17.5
  npmPackages:
    @sveltejs/adapter-auto: ^3.0.0 => 3.3.1 
    @sveltejs/adapter-static: ^3.0.6 => 3.0.6 
    @sveltejs/kit: ^2.9.0 => 2.11.1 
    @sveltejs/vite-plugin-svelte: ^5.0.0 => 5.0.2 
    svelte: ^5.0.0 => 5.13.0 
    vite: ^6.0.0 => 6.0.3

Severity

annoyance

Additional Information

In custom link components, this little nit can be worked around by passing undefined to target instead of a default value of _self.

@dummdidumm
Copy link
Member

Quoting Conduitry in #13165 (comment) :

Using target=_self as a way to indicate to an SPA framework that a given link should be treated normally rather than being intercepted predates SvelteKit. There are a number of frameworks that work this way. It may not have ever been documented in SK's docs - and there may be other official SK-specific ways of doing this - but I don't think we can just remove it. At the very least, removing this should be a breaking change.

So I'm not sure if we should be changing this

@dummdidumm dummdidumm added needs-decision Not sure if we want to do this yet, also design work needed and removed bug Something isn't working labels Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-decision Not sure if we want to do this yet, also design work needed
Projects
None yet
3 participants