Problem/Motivation

I've noticed a problem with Tocbot when using it in Drupal 11.3, I first thought it were my settings or theme specific css but that doesn't seem to be the case.

I could reproduce this in three different environments, with different theming and tocbot settings:

  • My own environment
  • A clean Drupal 11 install
  • A clean Drupal 11 install with the umami profile installed

I also tested this with tocbot from CDN and tocbot installed locally with composer (latest version).

I've recorded 3 videos to illustrate.

Steps to reproduce

Install Tocbot, set it up as you would and touch the scroll.

CommentFileSizeAuthor
webhaven.mov788.28 KBf0ns
umami.mov439.04 KBf0ns
standard-drupal.mov415.73 KBf0ns

Issue fork tocbot-3547569

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

f0ns created an issue. See original summary.

f0ns’s picture

I'm now testing with the latest Tocbot library version, I perhaps could test with older library versions and see if it's library specific or not to rule that out.

f0ns’s picture

Tested with some older Tocbot libraries but all three instances have the same issue.

I have already debugged so much that I don't know where to look anymore to be honest.

Will look into the tocbot-init.js once more. If I don't find anything there I think a fresh pair of eyes/someone smarter than me is needed.

f0ns’s picture

After a lot of debugging I think I found the issue.

When I set

options.headingsOffset = 1;

in the tocbot-init.js file just before tocbot.init() everything works great. Looks like it gets passed as text instead of a number and Tocbot doesn't throw an error and just doesn't work well then.

I'll dig deeper and look for a patch but if anyone else has this issue in the meantime this information could be helpful.

f0ns’s picture

Casting all properties that are numbers to an int (interpreted as a string otherwise) fixed it for me.

https://git.drupalcode.org/issue/tocbot-3547569/-/commit/4d1066e82927f51...

f0ns’s picture

Status: Active » Needs review

svendecabooter made their first commit to this issue’s fork.

svendecabooter’s picture

Status: Needs review » Fixed

Thanks, fixed now.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

  • svendecabooter committed 64aff2f1 on 2.0.x
    [#3547569] feat: .is-active-li jumps from first to last item on touching...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.