-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
many older doc versions have broken JS #8323
Comments
Thanks for the report! We have this chunk of JS embeded in the HTML: <script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
|
This is coming from the theme https://github.com/readthedocs/sphinx_rtd_theme/blob/8a026194285971d25fa80d47bc1a703b4d67f60d/sphinx_rtd_theme/layout.html#L228-L232 but I don't see anything being loaded async or in the wrong order <script type="text/javascript" src="https://media.readthedocs.org/javascript/readthedocs-doc-embed.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script> The only thing that could have made this happen would be if window is undefined.... which would be weird, I think? |
Looks like it's defined, so more like a race condition with the other part of the script being loaded before... but I don't understand how that would be possible with the current order |
Found in other projects as well, for example https://neuropsydia.readthedocs.io/ |
Another example: https://django-tenant-schemas.readthedocs.io/ It's weird. When the jQuery block is executed, |
Similar issue with the search page (e.x. gcsa with
) |
@kuzmoyev thanks for adding feedback here - this project is broken because it uses Sphinx 6.x and hasn't upgraded to sphinx-rtd-theme 1.2.0. If you can contribute a fix to them, that'd be great 👍 |
Thanks for the info. I'm the owner of the project. I don't have a cap on the |
@kuzmoyev haha, that makes it very easy for you to contribute to the project 💯 thanks for confirming that it works, I guess the former build from last week happened exactly before sphinx-rtd-theme 1.2.0 was released. |
I'm experiencing the same issue for sml2mqtt when building with |
Hi @spacemanspiff2007 - thanks for reporting. Looking at your build configuration, I didn't find anything problematic.
[1] edit: next time, I'll take a screenshot :) Now jQuery is gone from the output html. That's a much better explanation of what is going on. Will investigate, as the problem doesn't seem to exist in other builds. |
The last build from ~14 days ago worked fine so it seems there was something introduced in that time frame. |
This is also happening on https://nbsphinx.readthedocs.io/en/0.3.3/ and older. |
@mgeier it's the same symptom as #8323 (comment) describes. I can't see anything in the served JS that has changed, and the HTML is untouched (static). I think the issue might be browser-related. It's pretty hard to fix in this case. If anyone has access to an older browser, could be worth seeing how it works there.. |
Is there a browser where it is known to work? In all browsers I tried it consistently didn't work.
How old are you talking? I tried https://nbsphinx.readthedocs.io/en/0.3.3/ on browserstack.com, and it still doesn't work on those old versions: Windows/Firefox 32 For comparison, https://nbsphinx.readthedocs.io/en/0.3.4/ works fine on all of them. |
@benjaoming Do you need any further information? It seems to happen on all versions of all browsers ...
I guess most of the pages' HTML is static, but the HTML injected by RTD isn't, right? So it might be either the JS or the injected HTML? |
That's an interesting comparison! The most important difference is that 0.3.4 has:
...which 0.3.3 (broken version) doesn't. It doesn't load any theme.js file. It seems like both We should figure out if this is the common denominator for all the botched versions. Other notesDetails
Stuff that's the same:
0.3.4 (working fine) has this call at the end of its
0.3.3 has this:
I don't know the difference but calling |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
I think the new implementation of the
This way, we will keep old version working fine without rebuilding or touching the HTML at all. cc @ericholscher what do you think about this idea for once we have deployed the new addons more broadly? |
I've already implemented this in https://github.com/readthedocs/readthedocs-ops/pull/1402 and I'm currently testing it on our |
I also opened an issue at readthedocs/ext-theme#212 to discuss the possibility to let people opt-in into the new addons (new flyout, new search as you type, and others) and also fix their old using this process. I'd appreciate feedback on that to know if people is interested. |
I don't understand: will the "new flyout" replace the old integrated flyout even on old, already built page versions? How can an author "opt in" to something without re-building all their old stuff? I thought the idea was that old builds will just remain as they were. AFAIU, this issue is about fixing the JS in already existing builds, not about new builds.
It is working, but the content is not scrollable (see #7375). When I open the flyout on my small laptop screen, the top of it is out of view, so I cannot close it again. |
Yes, but not by default. At least right now. We are still in beta and testing it only on projects using "build.commands" only for now.
We think we will add an option on the project's setting for this. We are working on it to expand the usage of the new addons (including the flyout), but we haven't finished this work yet. Would you be interesting on give it a try on your projects when it's ready? Or even before that? (we have a way to enable it by request)
Yes. This is a bug in the current flyout addons we have already reported and we need to fix (readthedocs/addons#121) |
This issue is solved in the new flyout and it will release/deployed soon. Besides, we added an event listener that when clicking outside the flyout it also closes it. See readthedocs/addons#129 |
I think we can close this issue since the problem is solved when enabling the new beta addons on the project. You can enable them by:
Screenshot: Feel free to enable the beta addons and let me know if that solves the problem on your projects. I'm happy to re-open the issue if this is not solved after enabling the beta addons. Eventually, the beta addons will be enabled by default in all the projects. |
I wouldn't consider this solved, since this needs intervention by project maintainers. Many old pages are unmaintained (but still useful to readers), and those are still broken. |
I understand. I'm not sure what we could do to fix issues on unmaintained projects. There is a solution already, but it requires maintainers to enable new beta addons or to re-build their project with newer dependencies. |
I don't know either. Breaking those old pages damages the trust in the service RTD provides, at least it does for me. |
Currently, we are in a transition. Read the Docs Addons is in beta at the moment and we can't enforce projects to use it, and that's why we are giving users the ability to opt-in to give it a try. The beta Read the Docs Addons will eventually replace the old integration when it gets more mature. Enforcing using the Read the Docs Addons while they are in beta on all old projects is a big risk and we want to avoid it for now until we are sure it's going to work for most of the projects. |
What does "replace the old integration" mean exactly? |
With the introduction of the Read the Docs Addons, we already implemented the "replace the old integration" code. Basically, it removes the old HTML tags for the flyout and adds the new js implementation (see #8323 (comment))
Yes and no. Ideally, it will throw away the old integration (using the method described in the comment linked before) and use the new addons. Those themes that integrates the new addons will show the flyout whenever they want (example on Read the Docs Sphinx theme, and those that don't will show the flyout at the bottom right.
The "original functionality" will be eventually completely removed. Let me know if this clarifies the work and our path. I would also appreciate any feedback you may have for the proposed integration with the themes. |
Details
Expected Result
Clicking on the version selector down in the bottom left should work. It should pop up a selector that lets me pick a version of the docs.
Actual Result
Clicking on it doesn't do anything and there's an error in the console:
This appears to happen on old versions of docs for multiple projects that I tried. Happy to provide a few more if it's helpful. On https://django-reversion.readthedocs.io/en/latest/ the popup works correctly, but switching to one of the older versions breaks it.
The text was updated successfully, but these errors were encountered: