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

JS for back-to-top button throws error if user disabled button in config #1950

Open
drammock opened this issue Aug 13, 2024 · 0 comments
Open
Labels
kind: bug Something isn't working tag: javascript Pull requests that update Javascript code

Comments

@drammock
Copy link
Collaborator

drammock commented Aug 13, 2024

You can see it on any page of MNE-Python docs, e.g. https://mne.tools/dev/

Uncaught TypeError: document.getElementById(...) is null
    <anonymous> bootstrap.js:30

The error links to webpack://pydata_sphinx_theme/src/pydata_sphinx_theme/assets/scripts/bootstrap.js line 30, AKA here:

var btn = document.getElementById("pst-back-to-top");
btn.addEventListener("click", function () {

function needs an if(btn) guard before assigning listener

@drammock drammock added kind: bug Something isn't working tag: javascript Pull requests that update Javascript code labels Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working tag: javascript Pull requests that update Javascript code
Projects
None yet
Development

No branches or pull requests

1 participant