Skip to content

Click on <a> tag does not reliably scroll to section #229

@me-jterhorst

Description

@me-jterhorst

Describe the bug

I set up a small website, that is supposed to work like a single page application.
My main nav consists of 4 links of which the first is an Tag and the other three are regular with hashes as hrefs.

The Tags link to sections on my page and clicking on them should scroll the associated area into view,
however, when I am clicking on a link on a desktop browser I notice that sometimes the link will just become unresponsive and the page won't move at all unless I clicked it a few times or click to another link first and then the original one again.

On first load it seems to work reliably initially except for the furthest section. But once a link has been clicked and I scroll up to click the same link again, it will stop working unless I click the link up to 6 times.

On Mobile I have the same nav hidden behind a toggle, but so far I couldn't reproduce the problem there.

In my opinion it's worth mentioning that I tried to get around this problem by overwriting the default click behaviour of an Tag with an eventListener. I thought that document.getElementById("id").scrollIntoView() would give me the desired behaviour programmatically. But instead I got the same problem.

At another issue I saw that someone with a similiar problem suggested using target="_self" on the link but that did not fix my issue.

Your Example Website or App

https://logopaedie-langenberg.com/

Steps to Reproduce the Bug or Issue

  1. Go to the Web Page https://logopaedie-langenberg.com/
  2. Click on either "Über mich", "Anfragen", "Verordnungen
  3. If it scrolls to the associated section, go back up and click the same link again.

Expected behavior

As a User I expect to click the link and directly get to the desired information.

Screenshots or Videos

No response

Platform

  • OS: [ Windows 11]
  • Browser: [Edge(Chromium), Firefox]
  • Version: ["@solidjs/router": "^0.6.0", "solid": "^0.2.1", "solid-js": "^1.6.6"]

Additional context

No response

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