-
Notifications
You must be signed in to change notification settings - Fork 317
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
Make it possible to collapse the primary sidebar on wide screens #1072
Comments
I am +1 on adding a way to collapse the sidebar, even on wide screens/desktops. Though I am -1 on using a "hamburger" menu to achieve this, from a UX (user experience) perspective, hamburger menus (and the icon) are widely used to collapse navbars on smaller screens, so many users/readers might get confused by seeing this used to achieve a different task. I experienced this recently while doing some keyboard navigation assessment for JupyterBook - I and others were pretty confused as we had a mental model of what a "hamburger menu/icon" indicates in other apps and websites and the behaviour in JupyterBook did not match what we were expecting. In that sense, I would suggest an approach similar to what Docusaurus does by adding a arrow.mp4 |
+1 from me - if this is confusing in jupyter book I'd also welcome suggestions and PRs in the book theme for how to improve this! Hamburger menu is used right now because my UI/UX and CSS skills are not good enough to do more complex collapsing behavior. It'd be awesome if we could figure it out in this theme and we could just inherit in the book theme As a note: the book theme actually used to use a |
Interesting - I think something that might be adding to the confusion is that the hamburger button and the sidebar are next to each other (the button is floating to the right) rather than being more visually/structurally close. So it's not quite meeting the Gestalt proximity principle. I can put together some ideas that we could use here and in Jupyter book. |
I was just looking for this feature. I think a simple vertical think line with |
@smeragoel - this might be an excellent first design task to look into as you familiarise yourself with this project. |
I was asking myself, isn't showing the icons we use in smaller screen sufficient ? . |
Since the icon we show on small screens is a hamburger menu (see image below), this will introduce the issue I mentioned in this comment above - where other folks and I were pretty confused. We were expecting the hamburger icon to pull out a |
The vertical line proposed by @pllim will be an issue as many users have complained about the custom scrollbar being too thick (forcing us to remove it alltogether) so I'm not sure a 5-10px greybar will apeal to them more. I checked the other existing theme (https://sphinx-themes.org/) and very few are offering this option:
TBH I don't really see the problem, isn't it exactly what we are doing ? collapsing a menu with the sidebar content ? the arrows in general (double or simple) are to me even more confusing as they are widely used for pagination in technical documentations. When I typed "collapse sidebar website" in Google the first result from W3school is exactly using the hamburger icon for collapsing the sidebar. Shiny applications that I use on daily basis for work are also using it. I also checked framework and basic example from both bootstrap and vuetify are using the hamburger button for the sidebar collapsing. And now that I finish writting this I think I get your point 😩 : I checked the icon list and we cannot access in the free set to any sidebar icons but in #1250, we learned how to add extra icons so do you think it could be useful to use something like this instead: https://icon-sets.iconify.design/octicon/sidebar-collapse-24/ and flip it for "expand"/"collapse" ? |
The docusaurus approach that @trallard proposed is subtly different: the vertical gray bar with Personally for consistency I'd prefer that the If that still seems like a non-starter, I'm OK with the docusaurus-style compromise of having the "collapse" bar be horizontal at the bottom of the sidebar, and the "expand" bar being vertical at the screen edge. |
I am going to let @smeragoel look into a couple of options from a UX design POV and we can take it from there |
If we go down this path, I would suggest to move the arrow at the top of the sidebars as the secondary sidebar border doesn't go to the bottom of the screen. |
Okay, lots of excellent discussions here so I'll try to address all the points one by one!
Sidebar.Icon.-.WIP.Mockup.mp4 |
as per request, the custom scrollbar issue: #1239 |
Thanks @smeragoel I quite like the proposal of having the sidebar icon and keeping this in a consistent position. |
I think I stumbled upon what was proposed in #1072 (comment) but in real world over at https://mamba.readthedocs.io/en/latest/installation.html . Pretty much what was proposed but the location of the icon is slightly different. I prefer where they place it over at |
and what if we keep the existing positioning (in the header navbar) with a tooltip + the brand new icon ? |
I am +1 on trying option c above. I'd prefer the button to be in the article header but i also don't know how to combine it with the breadcrumbs in a non awkward way. So I think @smeragoel should give a shot at implementing the basic structure in that video and we can begin iterating from there. @12rambau when you say "existing positioning" do you mean to have the collapse button to the left of the logo all the time? I feel like on wide screens there is value in having that logo flush to the left since it is such a common design practice |
|
Thanks for the feedback everyone. I'll go ahead with this icon, mock up some different iterations of the positioning to see what works best, and also try to modify the button itself so that we don't have a rounded rectangle button just floating there all the time. @drammock regarding how much the icon moves and how much the content grows, I think it's somewhat going to depend on the user screen-size. Obviously, we should anchor it to something (for example, the widest it goes is the header, so the sidebar icon never moves past the logo on top). You're right in pointing this out in the video, I don't think it's the best example. I'll make it more true to intention in the next mockups. |
really? I think that the width of the left sidebar is fixed, and therefore the amount of space you could potentially gain for the main content is also fixed (i.e., unaffected by screen width --- as long as we're talking about widths above the cutoff for showing the left bar as a bar rather than in a drawer). But regardless of that, restating my earlier point: if I watch the little house icon in the breadcrumb (as a proxy for "left edge of main content"), I think it should end up further to the left when the sidebar is hidden. Currently it ends up aligned with the middle of the version switcher dropdown; I think it could go much farther.
agreed that in "sidebar hidden" state the new icon should not move any farther left than the left edge of the logo in the topbar. |
I made a new mockup with a different positioning and style of the button.
I'll take a fresh look at this again tomorrow, to fine-tune the size and positioning of the button, but until then feedback is welcome 😸 Sidebar.Icon.-.WIP.Mockup.2.mp4 |
that looks great IMO! |
Thanks! This is much better.
I am unsure if this is screen dependent - I would have imagined it would depend on the max width the main content container could take. I suppose we will have to figure this out during the implementation |
I just opened a duplicate issue suggesting something similar to this feature. I also dare to suggest that I would like the option to choose if the button is fixed -no matter the size of the screen- or not. I would leave it on -all the time- in the documentation of our library. Big thanks for your work! This theme is fantastic! |
I want to bump up this issue since we had some really good discussions and the design is done as well. I tweaked the last design to match the rest of the website and here's how it looks now: PyData.Sphinx.Theme.-.Collapsible.Sidebar.mp4
I'm open to more feedback, but if there's nothing major, I think we can move forward with the implementation so that this feature is live! |
Closing the loop here. I think this is a great design @smeragoel ✨ |
Currently, our primary sidebar is always visible on wide screens. On mobile screens, it becomes an off-screen drawer, with a hamburger menu to open it:
However, I think many people would also appreciate being able to close the primary sidebar on laptop/wide screens as well. This would allow them to focus on the content if they want to read closely. It was a fairly well-requested feature in the book theme, and works like this:
Proposal
Two changes:
hamburger menu
to the article header. Clicking it will hide the sidebar. It would disappear as you scrolled down the screen.The text was updated successfully, but these errors were encountered: