GitbookIO / GitbookIO/gitbook

Clicking headline #anchor on already anchor-linked page adds another #anchor

Open Beginner friendly
#4,246 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
29k
Forks
4k
Avg merge
1d 2h
Merged PRs (30d)
71

Description

Bug description

When visiting a gitbook-page with an anchor link like:

https://gitbook.com/docs/getting-started/quickstart#getting-started

Clicking again on a headline # adds to the existing url instead of replacing it. Invalidating linking to any of the anchors:

https://gitbook.com/docs/getting-started/quickstart#getting-started#getting-started

How to reproduce

  1. goto https://gitbook.com/docs/getting-started/quickstart#getting-started
  2. click the # in front of the Getting started headline
  3. copy URL from adress bar
  4. paste in new tab, Enter
  5. Page is at the very top, not at desired title
expected:

Clicking # replaces any existing #anchor in the URL, keeping it's functionality intact.

Additional context

Tested in

  • Firefox 151.0b7 (64-bit) and
  • Chrome 147.0.7727.139 (Official Build) (64-bit)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files or tests are named. Reproduce the URL-fragment behavior in Firefox or Chrome, then trace the frontend handling for the # link on the “Getting started” headline. Done means clicking it replaces the existing fragment with a single anchor and reopening the URL lands at the heading.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.