Skip to content

Refresh an URL with an anchor does not scroll to the anchor #2455

Open
@thominal

Description

@thominal
  • I confirm that this is an issue rather than a question.

Bug report

Steps to reproduce

  1. Create a test folder
  2. Put a README.md file in it
  3. In the README file, put the following text:
# test
::: tip
Content that takes place
:::
# test2
::: tip
Content that takes place
:::
# test3
::: tip
Content that takes place
:::
# test4
::: tip
Content that takes place
:::
# test5
::: tip
Content that takes place
:::
# test6
::: tip
Content that takes place
:::
# test7
::: tip
Content that takes place
:::
# test8
::: tip
Content that takes place
:::
  1. Launch vuepress dev
  2. Enter the URL http://localhost:8080/#test7

What is expected?

The browser should display the page scrolled at that test7 title position.

What is actually happening?

The browser do not take the anchor into account. The scroll of the page stays at the top.

Other relevant information

  • Tested on Chrome 83 / Edge
  • You can check a live example here: https://ivalua-user-guide.web.app/
    Just try the following link, you will see the issue: https://ivalua-user-guide.web.app/#test7
  • I checked with Chrome dev tools, it seems that when the URL is called, the page generates at first time the HTML, then the HTML is generated a second time. Strange thing, maybe it explains why the anchor does not work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions