Skip to content

Middle-clicking hash links may not jump #10245

@nilslindemann

Description

@nilslindemann

Describe the bug

Middle-clicking hash links on https://kit.svelte.dev/ may sometimes not jump to the hash.

Reproduction

Go to kit.svelte.dev/docs/errors. Middle-click on the first two hash links, "Error" and "type safety".

The "Error" link will, but the "type safety" link will not jump to the hash in the new tab, in these browsers:

  • Chrome 114.0.5735.133
  • Chromium 114.0.5735.133

(tested with fresh installs)

It will jump in these browsers:

  • Firefox 114.0.2 (fresh install)
  • Ungoogled Chromium 114.0.5735.106 (though I am not 100% sure if it did all the time, see below).

Interesting: developer.mozilla.org/.../Object/defineProperty also shows the same behavior in Chrome and Chromium 114.0.5735.133, and also in Ungoogled Chromium 114.0.5735.106 (weird), but it works in Firefox 114.0.2.

So, this may be a bug recently (re?)introduced in Chrome?

#4216 may be related. I can confirm that the link posted there does only scroll to the hash in Firefox. Middle clicking it in Chrome, Chromium and Ungoogled Chromium does not scroll to the hash.

For the records, the following document works in all browsers, middle-clicking the hash link jumps to the hash in the new tab:

<!DOCTYPE html><html lang="EN"><title>Jump to hash test</title><style>p { margin-bottom:1000px; }</style>

<p><a href="#hash">Jump to #hash</a></p>
<p id="hash">#hash</p>

</html>

Logs

No response

System Info

System:
    OS: Linux 5.15 Linux Mint 21.1 (Vera)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
    Memory: 12.10 GB / 15.36 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.3.1 - ~/Node.js/v20.3.1/bin/node
    Yarn: 1.22.19 - ~/Node.js/v20.3.1/bin/yarn
    npm: 9.7.2 - ~/Node.js/v20.3.1/bin/npm

Severity

annoyance

Additional Information

My guess is, SvelteKit tries to jump to something which is not yet rendered?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions