executablebooks / sphinx-book-theme

A clean book theme for scientific explanations and documentation with Sphinx
https://sphinx-book-theme.readthedocs.io
BSD 3-Clause "New" or "Revised" License
439 stars 201 forks source link

Pointless scrollbar appearing on short-enough sidebar #732

Open Gouvernathor opened 1 year ago

Gouvernathor commented 1 year ago

image As you can see, a scrollbar is generated even though the sidebar's contents is short enough not to need one. Also, scrolling that scrollbar actually works, so there is too much whitespace in that sidebar for no good reason, and that's probably causing the scrollbar to appear in the first place.

Gouvernathor commented 1 year ago

This doesn't happen on the doc of the theme. To fix this issue, you just have to add the following in the generated HTML, inside the <div id="rt-footer-container"> : <span class="fa"></span> That's how the theme doc does it (with other divs wrapping it and something inside the span of course), and the fix also works using a div as long as its class is "fa".

I don't know how to make my project insert that on every page though, and in any case the scrolling should not happen when not needed.

It also works if you delete the <div id="rt-footer-container"> entirely. Maybe there is a way for me to make it not generate one ?

avivajpeyi commented 1 year ago

Hey @Gouvernathor -- did you find a cleaner fix to this?

Maybe something can be added to a custom.css?

Gouvernathor commented 1 year ago

Nope, still hanging around with that useless scrollbar. I know almost nothing about CSS.

pradyunsg commented 1 year ago

Got a link to a page demonstrating the issue?

Gouvernathor commented 1 year ago

https://s3.seedboxws.com/ddl/usr00218/Senna/index.html Enjoy the free constitution.

thtrummer commented 1 year ago

CSS Workaround:

.bd-sidebar-primary div#rtd-footer-container {
    bottom:-1rem;
    margin:-1rem;
    position:fixed;
}
ebolyen commented 1 year ago

Ran into this also. I found that it seems to be the negative top margin (at least on Firefox) which causes the miscalculation on the total height.

If the CSS was more specific on the margin (margin-bottom: -1rem) I suspect the goal of escaping the sidebar padding would be achieved while allowing the flexbox to work normally (so long as you can tolerate the default gap from flex between the footer and injected ads).

_static/custom.css

#rtd-footer-container {
    margin-top: 0px !important;
}
mikegerber commented 9 months ago

We also ran into this and used the CSS workaround by @ebolyen.

sirex commented 6 months ago

Same here, and for me following worked (inspired by @ebolyen):

#rtd-footer-container {
    margin-top: 0px !important;
    margin-bottom: 0px !important;
}

For some reason, I also needed to add margin-bottom.