tidyverse / tidytemplate

A pkgdown template for core tidyverse packages
https://tidytemplate.tidyverse.org
Other
46 stars 22 forks source link

Clicking on a TOC link in an article highlights the second above the one you clicked #70

Closed DavisVaughan closed 2 years ago

DavisVaughan commented 2 years ago

I just clicked on "What does masking mean" and it brings you to the right section, but seems to highlight the one above it. It looks like non-tidytemplate sites don't have this problem.

https://rlang.r-lib.org/reference/topic-data-mask.html#what-does-masking-mean-

Screen Shot 2021-12-21 at 9 20 32 AM

i.e. compare to clicking on a TOC section here, which seems to highlight the one you clicked on https://pkgdown.r-lib.org/articles/customise.html#additional-html-and-files

hadley commented 2 years ago

This is because of :

    $('body').scrollspy({
      target: '#toc',
      offset: 56 // headroom height
    });

i.e. the scrollspy offset is fixed instead of using pkgdown-nav-height. This will need a fix in pkgdown.