Skip to content

Update layout of sidebar in documentation #10374

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

Merged
merged 3 commits into from
Mar 18, 2018

Conversation

timhoffm
Copy link
Member

@timhoffm timhoffm commented Feb 3, 2018

PR Summary

This PR contains some changes to the sidebar in the html documentation:

  • Move the search bar to the top. IMO it's one of the most important side bar items and it has a small fixed height. Therefore it's good to have it at the top.
  • Remove the section "This Page / Show Source". This was probably inherited from the sphinx defaults. However, it's rather useless if not confusing for the user to view the .rst source.
  • Make the search field use the full width. (Note: I've add recently sent a PR to sphinx that joins the search field and button Improved sidebar search field style sphinx-doc/sphinx#4377. This will be available from Sphinx 1.7 on. Until then it's at least visually more appealing to have the search field span the whole width).
  • Force the "Table of Contents" heading to be white as well. - It's a link and therefore was rendered black.

Index page before / after:

grafik grafik

Other pages before / after:

grafik grafik

@jklymak
Copy link
Member

jklymak commented Feb 5, 2018

I think this looks OK, but I was under the impression no one actually thinks the search works very well. If not, do we want it at the top?

@timhoffm
Copy link
Member Author

timhoffm commented Feb 5, 2018

I agree that the search is not great. But putting the search field in a varing not easily accessible place is no solution to this.

Either we want to have a search field (even with limited capability) - then it should be easily accessible at the top. Or we are a bit ashamed of the search and don't want to advertise it. Then, the search field should go completely. In that case I propose to add a "search" link next to index. That way the search is still accessible but less advertised.

Personally, I'd keep the search field. There's a lot of less useful results and the output format is not great, but at least for simple things like "xlim" it points me to the expected documentation (pyplot.xlim, Axes.get/set_xlim at the top). However, I can live with both versions, the top search field or no search field. A badly located search field just doesn't make sense.

@dstansby
Copy link
Member

dstansby commented Feb 9, 2018

FWIW I think the search works well and use it all the time, and it really annoys me every time I try and find the search box in the pandas docs that is hidden at the bottom of the sidebar.

Copy link
Member

@dstansby dstansby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm 👍, but a couple of other people should probably agree before this goes in.

@timhoffm
Copy link
Member Author

@tacaswell Do you have any recommendations who should review this before merging?

@anntzer
Copy link
Contributor

anntzer commented Mar 3, 2018

I kind of like having the source readily accessible (but that may be due to my unusally good relationship with rst :-)) and doubt that anyone would really be confused by the link.
Otherwise looks fine to me.

@anntzer anntzer added this to the v2.2-doc milestone Mar 3, 2018
@timhoffm
Copy link
Member Author

timhoffm commented Mar 3, 2018

The .rst source is not relevant for the users, so the link should not be in such a prominent place in the official docs. Additionally, the .rst contents is also quite useless in many cases, because it mostly contains headings and autodoc directives.

If there's consus that the link is of value for the developers anyway, I'd like to either show it only in the dev-docs, or alternatively make it less prominent (e.g. by moving it to the bottom of the page).

@jklymak
Copy link
Member

jklymak commented Mar 4, 2018

I'm not in favour of this change. I rarely if ever search websites using their internal search, and would personally prefer the navigation stay on top....

@timhoffm
Copy link
Member Author

timhoffm commented Mar 4, 2018

IMHO it's good UX to have permanent elements such as a search field in a fixed place. Since the navigation may become very long, the place of the search field may vary widely.

On the other hand, the search has a small fixed footprint. So the only effect is a slight constant shift of the navigation.

Note that with Sphinx 1.7 we can even reduce it further to a single line (sphinx-doc/sphinx#4377). Is it safe to assume that the docs will be built on sphinx 1.7+? If so I can update the css for the single-line search. If desired, one could also remove the title bar of the search field.

@anntzer
Copy link
Contributor

anntzer commented Mar 4, 2018

(independently of whether to keep the rst sources, I'm actually +1 in moving the search bar to the top)

@timhoffm
Copy link
Member Author

timhoffm commented Mar 4, 2018

I've now CSS-styled the search bar to make it single line and thus take less space at the top (This is now hardly more space than the excess whitespace the current docs have at the top of the side bar).

Note: This needs sphinx 1.7+. Since the devdocs are built with this version already, I assume this is not a limitation.

grafik

@timhoffm
Copy link
Member Author

timhoffm commented Mar 4, 2018

Any more opinions on whether to keep or to drop the .rst source link?

@dstansby
Copy link
Member

dstansby commented Mar 4, 2018

I'm +1 for getting rid of it (i.e. not that bothered, but in favour of. I'm more like +5 on moving the search box up 😛 )

@timhoffm timhoffm force-pushed the doc-sidebar-layout branch from 8cbe1ea to 29f3d23 Compare March 13, 2018 23:34
@timhoffm
Copy link
Member Author

rebased to fix tests.

@timhoffm
Copy link
Member Author

@anntzer I understand that sometimes there is a certain value in having access to the .rst source. Would it be an option to still have a page source link, but to clearly set it apart from the regular navigation? E.g.

grafik

@anntzer
Copy link
Contributor

anntzer commented Mar 18, 2018

Having it "half hidden" as proposed is fine with me.

@timhoffm
Copy link
Member Author

Page source link added back in and some layout improvements. Here's the final result

grafik

@tacaswell tacaswell merged commit 74f06dd into matplotlib:master Mar 18, 2018
tacaswell added a commit that referenced this pull request Mar 18, 2018
@timhoffm timhoffm deleted the doc-sidebar-layout branch March 18, 2018 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants