sphinx-book-theme icon indicating copy to clipboard operation
sphinx-book-theme copied to clipboard

Pointless scrollbar appearing on short-enough sidebar

Open Gouvernathor opened this issue 2 years ago • 9 comments

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 avatar May 17 '23 23:05 Gouvernathor

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 ?

Gouvernathor avatar May 18 '23 00:05 Gouvernathor

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

Maybe something can be added to a custom.css?

avivajpeyi avatar Jul 30 '23 23:07 avivajpeyi

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

Gouvernathor avatar Jul 30 '23 23:07 Gouvernathor

Got a link to a page demonstrating the issue?

pradyunsg avatar Jul 31 '23 00:07 pradyunsg

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

Gouvernathor avatar Jul 31 '23 00:07 Gouvernathor

CSS Workaround:

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

thtrummer avatar Oct 09 '23 08:10 thtrummer

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;
}

ebolyen avatar Nov 08 '23 20:11 ebolyen

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

mikegerber avatar Feb 20 '24 20:02 mikegerber

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.

sirex avatar May 18 '24 19:05 sirex