Theme expand by default not working
brianjo opened this issue · comments
The expand by default code doesn't seem to be working. Is there a way we can set that in script without having to rebuild the whole documentation set?
Also, when a user clicks a heading and goes to the new page, the section is again collapsed. It would be optimal if that stayed open on click.
Could we possibly use a cookie to save expand/collapse state for the user? That might be best for everything.
See the note in pytorch/tutorials#1372 and the new PR #97.
Hey @brianjo,
pytorch/pytorch#52703 needs to be merged in for the Docs and then the documentation set will need to be rebuilt in order to add the script to the Docs and Tutorials.
when a user clicks a heading and goes to the new page, the section is again collapsed. It would be optimal if that stayed open on click.
The current implementation will collapse sections when a user reloads the page or navigates to a new page. I can work on implementing a change where the state of the section stays the same on a new page.
@Bgreen23 Hi Brandon, It's landed for tutorials here: https://github.com/pytorch/tutorials/blob/master/_templates/layout.html but we're not seeing the correct behavior when the page is loaded. It's all live now there. I haven't merged docs because I want to fix the expand/collapse persistence issue and I'm thinking about rolling back the theme on docs. Thanks!
So this is what is in our requirements.txt when we build tutorials:
-e git+git://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme
And this is a preview I just ran a while ago:
https://deploy-preview-1377--pytorch-tutorials-preview.netlify.app/
Can you tell if I'm missing something?
Also please see #97, and let me know if that would fix it? (The theme is used by bunch of different projects and so it looks like I'm not the only one seeing the issue.)
Thanks!
I'm seeing the outdated expand/collapsed function in your preview when I view the theme.js
(see screenshot attached). The outdated function doesn't include collapsedSections
which is why it's not working as intended. This lines up with how #97 solved their issue by running grunt build
. Let me know if that clears anything up and if you have any additional questions!
Sorry, the solution to this isn't clear to me. Should I merge #97 to fix the issue?