tocbot: Cannot read property 'className' of null

I’ve observed that when I use lists (ul, ol) in the html, I’m getting this error:

 Uncaught TypeError: Cannot read property 'className' of null
    at Object.updateToc (build-html.js:210)
    at HTMLDocument.<anonymous> (index.js:164)
    at index.js:74

And the error in the build-html.js is in:

if (activeTocLink.className.indexOf(options.activeLinkClass) === -1) {
        activeTocLink.className += SPACE_CHAR + options.activeLinkClass
      }

I’m not sure if I’m doing something wrong or it’s related to the css framewrok I’m using (chakra-ui) (but I’ve tried out standard html I’m also getting these errors)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 16 (7 by maintainers)

Most upvoted comments

Already fixed, I realized it was my problem and didn’t notice that the blogger had updated to version 18 and I was still using the old one

Thanks for investigating. I’m going to leave this issue open until we have a better idea of all the cases that may cause this issue.

@tscanlin just found out that this happens only when you are logged into your codesandbox.io account! (macOS with Chrome 88 and Firefox 85) when you simply scroll.

I couldn’t reproduce this when not logged to my codesandbox.io account (with Chrome 88, Firefox 85 and Safari 13.1.2).

Screen Shot 2021-02-19 at 10 01 53

Definitely something codesandbox.io is doing under the hood.