-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
move quick search box above TOC #63688
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
Comments
From Mark Summerfield:,
|
If this is referring to the box on docs.python.org shouldn't this be logged elsewhere? |
Yes, I don't think we control this, the layout is generated by sphinx. |
It looks like this can be fixed by us. Since sphinx 1.0 there is this handy config parameter: http://www.sphinx-doc.org/en/stable/config.html#confval-html_sidebars I've attached a patch which pins the searchbox as the first thing on every page. |
bump, added the documentation experts list, not sure if the core dev who made this issue is still active. |
The patch needs some work, as it stands it makes the 'Report a Bug' link disappear. I haven't looked into it far enough to determine why. For an alternative bikeshed color, would it be possible to put the quick search in the header, just left of the 'previous | next | modules | index' links? |
Thank you for pointing that out to me, it completely slipped past. It looks like the 'Report a Bug' link disappears because deprecated api is used in Doc/tools/templates/layout.html {% block sidebarsourcelink %} http://www.sphinx-doc.org/en/stable/templating.html#blocks
I've amended the patch to fix this by using the way they recommend with a custom html_sidebar. As far as putting it in the title bar goes, I think it's slightly more prone to breakage since we're essentially duplicating sphinx's searchbar code. It's easy enough to add it to the right of those links, there's a {% block relbaritems %} for that. Adding it to the left is slightly more complicated. Personally I like just pinning it to the top of the sidebar but I can look into that as well if you really want. |
This LGTM. If it's simple enough, I'd like to see a shot at putting the search box in the top bar, but it's not necessary :) I'll commit this in the near future unless somebody beats me to it. |
This patch adds the search bar to the navigation/header area on the right. |
Amended the navigation bar patch to add back a change that only shows the searchbar if javascript is enabled. |
I really like the search box in the header/footer. I can't really speak for the actual content of the patch since my Sphinx/HTML/CSS/Jinja/whatever else knowledge is severely limited, but it looks pretty straightforward and the result is very nice. I'd appreciate a review from someone who's better-versed in all things Sphinx (Georg, if you have a chance, you'd be ideal). If there are no objections within about a week, though, I'll just go ahead and commit it. |
This looks pretty good to me, thanks! I have two minor suggestions:
Also,
may cause weird compatibility problems in some (old?) browsers. We can change it to use display: inline-block instead. Is there a way to send this to upstream Sphinx? |
Do you mean in addition to the "Quick search" text that is already on the page or do you want to remove that? Because placeholder isn't fully compatible with some older browsers http://caniuse.com/#feat=input-placeholder
Good idea, will fix this.
What problems are you thinking of? I think Also, newer versions of sphinx come with a newer jquery that breaks compatibility with IE8 which would cause the search box to not appear anyway.
I don't think so, it's one of those things that make sense as a theme, which is perfect since we have our own sphinx theme anyway. |
Moving back to patch review for someone to sign off on the changes. |
Berker, would you mind giving this another look? If you give it the OK, I can get it committed if you don't beat me to it. |
The latter. All of the popular browsers (Chrome, Firefox, Edge and even Safari) already support the placeholder attribute so I think we can safely ignore IE 8 :)
Honestly, I can't remember now, but I was talking about old Chrome and Firefox versions. Let's ignore my comment for now. I have two more minor comments:
I also found a regression in search.html. It doesn't show or highlight the search Screenshot from docs.python.org: https://dl.dropboxusercontent.com/u/166024/highlight-docs.pyo.png Screenshor from my local copy with searchbar_in_header.diff3 applied: https://dl.dropboxusercontent.com/u/166024/highlight-after.png |
Please ignore this. It doesn't have anything to do with your patch. |
Roger, I've changed it to placeholder.
The reason that exists is because sphinx's search relies on javascript.
Good catch, I've removed the class from there. |
New changeset 274b25cd501f by Zachary Ware in branch '3.5': New changeset 0f94a8fa5445 by Zachary Ware in branch 'default': |
New changeset 8927417c5e88 by Zachary Ware in branch '3.5': New changeset 086c3e7a7955 by Zachary Ware in branch 'default': |
Ammar, thank you very much for the patch! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: