paradox icon indicating copy to clipboard operation
paradox copied to clipboard

TOC highlighting does not match actual page position

Open TimMoore opened this issue 7 years ago • 1 comments

If you go to a page such as https://developer.lightbend.com/docs/lightbend-orchestration-kubernetes/latest/kubernetes-deployment.html or https://developer.lightbend.com/docs/akka-management/current/discovery.html and scroll down slowly, you can see that the highlighting in the TOC starts to move down more quickly than the actual page does. In other words, it highlights section titles that you have not yet reached.

Tested in Chrome 66 and Safari 11.1 on Mac.

It looks like it moves the highlight down whenever scrolling past any header, not just ones in the list. This is probably a bug in Zurb Foundation, but it is probably possible to work around it.

The default theme adds data-magellan-target attributes to all headers up to depth 3:

https://github.com/lightbend/paradox/blob/8388b80bb3e83f753971f9b357223136e422777f/themes/generic/src/main/assets/js/magellan.js#L3-L11

But the depth of the navigation is configurable, and defaults to 2:

https://github.com/lightbend/paradox/blob/6723b5fe5769874583fd367c926ef47cd2869e19/plugin/src/main/scala/com/lightbend/paradox/sbt/ParadoxPlugin.scala#L45

Making these match would likely fix the bug. This could be done when iterating through the links in the .page-nav by attaching the data-magellan-target to matching headers there.

TimMoore avatar May 10 '18 02:05 TimMoore

Yes, these defaults have drifted apart. Having the same navigation depth of 3 works. Would be good if it automatically aligned itself to the generated nav instead.

pvlugter avatar May 10 '18 02:05 pvlugter