sphinx_rtd_theme icon indicating copy to clipboard operation
sphinx_rtd_theme copied to clipboard

Hide/autohide navigation bar (similar to mobile behavior)

Open klieret opened this issue 5 years ago • 7 comments

When writing tutorials in sphinx, we usually ask students to have the tutorial and the terminal side-by-side on their screen. However, the sidebar in sphinx is quite large and there's not much screen space left for the actual tutorial.

It would be really useful if the side bar would auto hide or could be hidden by the press of a button.

I know it's possible to hide it using something like



.wy-nav-side {
  display: none;
}

.wy-nav-content-wrap {
  margin-left: 0;
}

but it would be really nice to make have the option of toggling it.

klieret avatar Aug 06 '20 14:08 klieret

as a vertical screen user, I also miss this feature. As you can see, a lot of the page is losing in a useless black space.

image

mgaitan avatar Sep 28 '20 02:09 mgaitan

It would of course be great to have this in the RTD theme, but until that happens, if you are seeking for an alternative theme in which you can hide the sidebar, you might have a look at my quite young theme https://insipid-sphinx-theme.readthedocs.io/. Most likely, there are a few other themes with such a feature.

mgeier avatar Oct 20 '20 20:10 mgeier

if you are seeking for an alternative theme in which you can hide the sidebar, you might have a look at my quite young theme https://insipid-sphinx-theme.readthedocs.io/

It looks like this theme has an option to hide the sidebar for certain pages, but it does not make the sidebar collapsible. A collapsible sidebar ("at the press of a button") is what this issue is proposing.

+1 to the proposal, by the way. And a ping to @hwayne from the connected issue who said that he could whip up a css to do this.

felixvd avatar Dec 16 '22 00:12 felixvd

For anyone looking for another theme that supports this: https://sphinx-book-theme.readthedocs.io/en/stable/ has a button on the top (three horizontal lines). However, you have to click on it for every new page (that's fine for my use case, but probably not for people who want this feature because of vertical screens or other constraints)

klieret avatar Dec 16 '22 02:12 klieret

if you are seeking for an alternative theme in which you can hide the sidebar, you might have a look at my quite young theme https://insipid-sphinx-theme.readthedocs.io/

It looks like this theme has an option to hide the sidebar for certain pages, but it does not make the sidebar collapsible. A collapsible sidebar ("at the press of a button") is what this issue is proposing.

There is a button (consisting of three vertical lines) for that at the very top left (if that's not visible for you, please let me know!). On touch-enabled devices, the sidebar can be shown/hidden by swiping right/left. And there is also a keyboard shortcut m (for "menu") for that (in combination with Alt, Shift and/or Ctrl, depending on your browser, see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/accesskey).

The visible/hidden state is stored in your browser's LocalStorage, so it should stay the same when switching between pages of a subdomain (unless JavaScript is disabled).

mgeier avatar Dec 16 '22 07:12 mgeier

There is a button (consisting of three vertical lines) for that at the very top left

That works, in the same way as the one klieret just linked. I just didn't see it, my bad. The hamburger icon says "Click to see a menu" to me, I expected an arrow pointing left or similar for folding.

Thanks!

felixvd avatar Dec 16 '22 08:12 felixvd

Any updates on this? Would still be very interested in a collapsible sidebar in the sphinx rtd theme :smile:

lola-masson avatar Aug 23 '23 13:08 lola-masson