Skip to content

scroll-padding doesn't get respected when navigating to a page with hash #15192

@levi-jcbs

Description

@levi-jcbs

Describe the bug

When navigating to a page with hash, the scroll-padding gets ignored.

Normally it scrolls less far, so the header doesn't cover the element I want to scroll to. This works, when loading the site directly, but not when navigating in svelte.

Reproduction

Minimal reproduction repo: https://github.com/levi-jcbs/svelte-scroll-padding-test

Logs

System Info

System:
    OS: Linux 6.12 Debian GNU/Linux 13 (trixie) 13 (trixie)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
    Memory: 18.44 GB / 31.08 GB
    Container: Yes
    Shell: 5.2.37 - /bin/bash
  Binaries:
    Node: 20.19.2 - /usr/bin/node
    npm: 9.2.0 - /usr/bin/npm
  Browsers:
    Chrome: 143.0.7499.192
  npmPackages:
    @sveltejs/adapter-auto: ^3.0.0 => 3.3.1 
    @sveltejs/adapter-node: ^5.5.1 => 5.5.1 
    @sveltejs/kit: ^2.50.0 => 2.50.0 
    @sveltejs/vite-plugin-svelte: ^4.0.0 => 4.0.4 
    svelte: ^5.0.0 => 5.47.1 
    vite: ^5.0.3 => 5.4.21

Severity

annoyance

Additional Information

Discord Thread: https://discord.com/channels/457912077277855764/1462015454095868095

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions