-
Notifications
You must be signed in to change notification settings - Fork 339
ENH: manage sidebars on small screens #726
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
Conversation
Agreed this one would be quite useful. A few relevant issues where this has been discussed:
In particular, I wrote out a little suggested implementation in the top comment here: That is based on the pattern that Furo and the Sphinx Book Theme use. It is also similar to the approach that the sphinx-basic-ng theme takes (cc @pradyunsg). As an example:
I think this would definitely be useful! Happy to help provide guidance on implementation if you're interested in this route. |
New version fully based on css. Could you test it from your side ? I'm pretty sure there are edge cases that I didn't catch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is generally looking really nice! I made a few suggestions and comments in there but I think it would be a great improvement!
One thing we don't need to do now, but might explore over time if the header feels too cramped, is adding a secondary header that hides itself on wide screens, and put the sidebar toggle buttons in there.
@@ -2,17 +2,21 @@ | |||
* The primary sidebar on the left. | |||
* e.g., between-pages navigation. | |||
*/ | |||
.bd-sidebar { | |||
.bd-sidebar-primary { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm +1 on this, but just a note that this will be a breaking change so we should note it in the release notes
src/pydata_sphinx_theme/assets/styles/components/_sidebar_toggle.scss
Outdated
Show resolved
Hide resolved
src/pydata_sphinx_theme/theme/pydata_sphinx_theme/sections/sidebar-secondary.html
Outdated
Show resolved
Hide resolved
There are still issues with breakpoints as breakpoints-up and breakpoint-down are not behaving the same way. What do you think if I fix these values for both sidebars as layout variables ? |
I'm not exactly sure what you mean by this, but if you're saying that we use |
OK I made a little bit of progress here, just pushed a commit that reworks the sidebar logic a little bit, but I think there is still more to be done. The spacing is a little bit off, and the buttons don't show up at quite the right time, but it is an iterative improvement I hope 😬 (also merged I can try to keep thinking on this one, but just wanted to push the work thus far for transparency and so we don't accidentally make a big merge conflict |
That's excellent Correct me if I'm wrong but the offset to leave space for the article-header is never changed even when no header is on the page right ? That's not a problem to me just want to make sure that it's a feature |
I think that's true - I figured that it would look weird if the titles of pages jumped up and down based on whether there were going to be sidebars. |
I fixed the test for the new sidebar implementation, I think we cannot test the behaviour in the current tests, that will be something for #585 I'm happy with the curent state, @choldgraf thanks for your help! |
Ah thanks for fixing the test! Hmm, so what do you think we should do about this PR re: the next release? I think it seems in pretty good shape, should we get it into v0.10? Or hold off until that is released before merging this one in? My feeling is that we'll need to make a release candidate with this release anyway, so that could provide some time for others to provide feedback on the sidebar behavior. What do you or others think? |
I'm timeline agnostic.Although It's a big change but highly requested one (many documentations are playing with their custom css to avoid the primary sidebar to end up on top of the page on small screen). I think it's ready to go. Happy to hear others feelings about it being shiped with v0.10 |
anybody else have thoughts on #726 (comment) ? cc @jorisvandenbossche @jarrodmillman @drammock @bryevdv @tupui |
Oh waou this is great! Since it's a major improvement, I would not delay it. Otherwise it seems intuitive. I am just not sure if it should not stick when you scroll (maybe a floating object like rdt is doing?). In any case it can be continued in another iteration. |
I'd say put it in the RC, don't wait until after release. |
OK in that case, I think we should merge this in a day or two (ideally after an iteration of comments from somebody :-) ) |
OK unless anybody objects I'll plan to merge this one later today or tomorrow, and then we can get feedback from folks in new issues etc |
OK let's merge this one and iterate a bit! |
@@ -86,6 +87,11 @@ | |||
/* Between-page links and captions */ | |||
nav.bd-links { | |||
font-size: var(--pst-sidebar-primary-font-size); | |||
margin-right: -1rem; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@12rambau do you remember why you styled nav.bd-links
(the nav element containing the section navigation links) to have margin-right: -1rem
? (Aside: can you tell me what the bd-
prefix means?)
I can plainly see and understand why you set the negative -1rem margin for the in-page TOC in the right sidebar (it's so that the vertical notch that indicates the current section is aligned properly), but so far I haven't been able to figure out what the -1rem margin is doing for the left sidebar. (On the left sidebar, the current section notches are not aligned to any vertical line.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the bd-
prefix is the bootstrap one that they use usually in their demo examples. it's a very old issue but for the release of version 1 we would like to get rid of them #37.
About the -1rem
I guess the only way to find out is to remove it 😄
That's still a draft so i'll track down all the issues referencing this problem later.
Context
Lot's of people are complaining that the theme is not as responsive as they would expect on small devices. Specifically the sidebars both primary and secondary are a burden for everyone as they are not properly managed in the theme forcing people to discard them most of the time (specifically true for the secondary one).
proposal
In this PR I proposed to improve the design by transforming the 2 sidebars into drawers on small screens. One on the left and one on the right. without changing the interactivity that we already have on bigger screens
TODO
Before I continue working on it I would like to have other feedback to see if this feature is useful or not. (to test it simply go to small screen the rest is behaving funny.