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

Table of contents and footer can overlap when using stickysidebar #11557

Open
tyralla opened this issue Aug 7, 2023 · 4 comments
Open

Table of contents and footer can overlap when using stickysidebar #11557

tyralla opened this issue Aug 7, 2023 · 4 comments

Comments

@tyralla
Copy link

tyralla commented Aug 7, 2023

Describe the bug

The problem occurs when the content of a page is "shorter" than the table of contents.

Here is a real example (that occurs in combination with fulltoc):

image

And this is my minimal example (without fulltoc):

image

How to Reproduce

conf.py

project = 'test'
copyright = '2023, me'
author = 'me'
release = '0.0'

extensions = []

templates_path = ['_templates']
exclude_patterns = []

html_theme = 'classic'
html_static_path = ['_static']
html_theme_options = {"stickysidebar": True}

index.rst

page 1
======

.. toctree::
   :hidden:

   page2

page2

page 2
======

Environment Information

Platform:              win32; (Windows-10-10.0.19045-SP0)
Python version:        3.11.2 (tags/v3.11.2:878ead1, Feb  7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)])
Python implementation: CPython
Sphinx version:        7.1.2
Docutils version:      0.20.1
Jinja2 version:        3.1.2
Pygments version:      2.14.0

Sphinx extensions

No response

Additional context

No response

@picnixz
Copy link
Member

picnixz commented Aug 9, 2023

I had a quick look at the CSS/HTML and I think the way that the side-bar is rendered may not necessarily be correct. The issue lies in the position: fixed instead of a position: sticky. However, with position: sticky, when the content is of normal length, the sidebar is not sticky at all and stays at the top of the page (and hence is hidden when scrolling down). AFAICT, this is due to the fact that both the content and the sidebar are actually in the same container but I'm not well-versed enough in HTML/CSS to know how to properly fix it so anyone who's willing to help is welcomed.

@tyralla
Copy link
Author

tyralla commented Aug 9, 2023

Thanks for having a look at this. Unfortunately, this internet stuff is definitely not my expertise, so I hope someone else is interested.

@AA-Turner AA-Turner added this to the some future version milestone Aug 11, 2023
@tyralla
Copy link
Author

tyralla commented Aug 22, 2023

@parvumflumen provided a fix which he added to our project as a custom theme:

image

I have no idea if the modified theme would work well in other projects with different configurations, but maybe it does or can at least serve as a starting point for improving the original Sphinx theme.

@picnixz
Copy link
Member

picnixz commented Aug 25, 2023

They are welcome to submit a PR if they think this can help in improving the current HTML/CSS, though I won't be able to review anything major until late september. Or they could discuss what should be done / has been done on this issue directly.

cc @parvumflumen

t-b added a commit to AllenInstitute/MIES that referenced this issue Jul 8, 2024
Since a couple of sphinx versions the collapsible sidebar is kind of
broken, the closest issue I found was [1].

A different fix from [2] allows to nicify the layout at the cost of not
having the sidebar being collapseable [2].

[1]: sphinx-doc/sphinx#11557
[2]: https://stackoverflow.com/q/64668990
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants