Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readthedocs theme TOC scrolling JS exception #1177

Closed
cgwyllie opened this issue Mar 22, 2017 · 0 comments · Fixed by #1192
Closed

readthedocs theme TOC scrolling JS exception #1177

cgwyllie opened this issue Mar 22, 2017 · 0 comments · Fixed by #1192
Labels

Comments

@cgwyllie
Copy link

In the readthedocs theme (mkdocs, version 0.16.2) we're seeing an exception from this line: bounds.top = this.offset().top; in the theme.js file.

It seems this was introduced by #1156 and referenced from #803.

We can observe it happening when the currently active TOC item is below the fold (scrolled off screen to the bottom).

Here's the stack trace:

Uncaught TypeError: Cannot read property 'top' of undefined
    at n.fn.init.$.fn.isFullyWithinViewport (theme.js:67)
    at HTMLDocument.<anonymous> (theme.js:74)
    at j (jquery-2.1.1.min.js:2)
    at Object.fireWith [as resolveWith] (jquery-2.1.1.min.js:2)
    at Function.ready (jquery-2.1.1.min.js:2)
    at HTMLDocument.I (jquery-2.1.1.min.js:2)

Testing in Chrome 56.0.2924.87 on macOS 10.12.3.

As a workaround we've created an override theme.js file to remove the scroll behaviour.

@waylan waylan added the Bug label Mar 22, 2017
kylegregory added a commit to kylegregory/mkdocs that referenced this issue Mar 23, 2017
Fixes a JavaScript error when looking for a current page in the TOC
when there is not a current page selected, in the case of Search, 404
or any page that isn’t listed in the TOC. This checks if a TOC item
with the class of ‘current’ is in the document, and if not, does not
call the viewport check or scroll the TOC area.

Addresses mkdocs#1177, introduced in mkdocs#1156 and referenced in mkdocs#803.
waylan pushed a commit that referenced this issue Apr 4, 2017
Fixes a JavaScript error when looking for a current page in the TOC
when there is not a current page selected, in the case of Search, 404
or any page that isn’t listed in the TOC. This checks if a TOC item
with the class of ‘current’ is in the document, and if not, does not
call the viewport check or scroll the TOC area.

Fixes #1177.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants