Docusaurus: Cannot move to another page's anchor

Created on 6 Jun 2020  路  11Comments  路  Source: facebook/docusaurus

馃悰 Bug Report

Cannot move to another page's anchor when clicking the link.

Have you read the Contributing Guidelines on issues?

yes

To Reproduce

  1. Add a page named "doc1" with the following contents

    ## foo
    here require large contents enough to scroll
    ...
    ...
    ...
    ...
    ...
    
    ## bar
    some contents
    
  2. Add a page named "doc2" with the following contents
    markdown [link to another page's anchor](doc1#bar)
  3. Build the pages and open the browser
  4. Click the link at the page "doc2"

Expected behavior

Move to the "bar" on the page "doc1"

Actual Behavior

Just move to the page "doc1", but the scroll position is incorrect (=top).

Your Environment

  • Docusaurus version used: ^2.0.0-alpha.55
  • Environment name and version (e.g. Chrome 83.0.4103.97, Node.js 12.14.0):
  • Operating system and version (desktop):

Reproducible Demo

https://shinout.github.io/docusaurus-incorrect-anchor-move-repro/docs

  • Click the link doc1#Images at Document Number 2(doc2)
bug

Most helpful comment

Oh that's great! Look @JoelMarcey I hired a fellow without knowing 馃帀

All 11 comments

This should work as intended if you use lowercase, i.e. doc1#images instead of doc1#Images

Indeed! Anchor links are slugified hence will become lower case. Thanks Teik Jun! Hi there fellow 馃嚫馃嚞 -ean!

Hi Yangshun! :D

Thank you for your help.
Then I'm wondering how to link multibyte strings. I use Japanese and this happens when an anchor contains some Japanese characters. It won't work well.

Hi @shinout, if you think we should reopen, can you make a repro please?

I've made a repro for the issue mentioned by @shinout

To Reproduce:

  1. Visit https://docusaurus-anchor-repro.now.sh/docs/doc2
  2. Click "go to a header written in japanese" link

It goes to the start of the page instead of the actual header

Reproducible Demo:
Repo: https://github.com/teikjun/docusaurus-anchor-repro

@teikjun Thank you for that! Btw are you an MLH fellow? Just wondering about the increased interaction here 馃槂

Yup, I'm an MLH Fellow! I heard about the fellowship from your tweet 馃槃

Oh that's great! Look @JoelMarcey I hired a fellow without knowing 馃帀

Welcome @teikjun!!

@teikjun Thank you for preparing reproduction!
@yangshun Thanks for reopen the issue.

Should I add to the title of this issue when using multibyte string ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

omry picture omry  路  3Comments

rickyvetter picture rickyvetter  路  3Comments

ericnakagawa picture ericnakagawa  路  3Comments

endiliey picture endiliey  路  3Comments

JoelMarcey picture JoelMarcey  路  3Comments