msg79986 - (view) |
Author: Terry J. Reedy (terry.reedy) *  |
Date: 2009-01-16 23:30 |
In the Windows help version of the docs that come with the Windows .msi
installer, the index pane to the left scrolls separately from the
content pane to the right. Very nice for jumping around even to other docs.
In the html versions at docs.python.org, there is one scroll bar and the
index disappears when one moves very far down the page. If sensibly
possible, decoupling index and context would be nice. Please pardon my
ignorance if not.
|
msg80437 - (view) |
Author: Senthil Kumaran (orsenthil) *  |
Date: 2009-01-24 06:56 |
Terry, I think you mean the Sidebar content, right?
Yes, I agree with you. It would be desirable to have the Sidebar
Fixed, while we scroll the document (Like this:
http://www.w3.org/Style/CSS/)
This has to be worked out in the Sphnix CSS.
|
msg81302 - (view) |
Author: Georg Brandl (georg.brandl) *  |
Date: 2009-02-06 21:53 |
I've experimented with a style variant that keeps the sidebar fixed on
the left side, however I did not manage to get it to show a separate
scrollbar. Maybe I was just stupid though.
|
msg81306 - (view) |
Author: Ezio Melotti (ezio.melotti) *  |
Date: 2009-02-06 22:08 |
Something like this maybe?
div.sphinxsidebar {
float: left;
width: 230px;
height: 100%;
font-size: 90%
/* add these: */
margin-top: 30px;
height: 100%;
overflow: auto;
position: fixed;
}
...
div.related {
background-color: #133f52;
color: #fff;
width: 100%;
line-height: 30px;
font-size: 90%;
/* add this: */
position: fixed;
}
I tested it only with Firefox3 and the Webdeveloper plugin and it looks
ok. "position: fixed" doesn't work on IE6 and there could be other
problems, but it may be a good starting point.
|
msg89966 - (view) |
Author: Ezio Melotti (ezio.melotti) *  |
Date: 2009-07-01 09:03 |
See also #3143.
I'll try to do a proper patch to fix this issue.
|
msg89971 - (view) |
Author: Ezio Melotti (ezio.melotti) *  |
Date: 2009-07-01 10:20 |
"overflow: auto" should fix #4711 too (adding an horizontal scroll bar
at the bottom of the sidebar).
|
msg174843 - (view) |
Author: Ezio Melotti (ezio.melotti) *  |
Date: 2012-11-04 23:31 |
The attached patch makes the sidebar fixed and adds a scrollbar to scroll it separately when it's longer than the page.
To test the patch without rebuilding all the Docs you can do something like:
hg import --no-c <url-of-the-patch>
cp Doc/tools/sphinxext/static/basic.css Doc/build/html/_static/basic.css
firefox Doc/build/html/library/multiprocessing.html
Since the sidebar doesn't start at the top of the page because there's the header first, when the main page is scrolled down, some empty space is left over the sidebar. I think this can't be fixed with css alone (unless some major changes are done to the layout), it could be fixed with js or the header could use position:fixed too.
|
msg175230 - (view) |
Author: Ezio Melotti (ezio.melotti) *  |
Date: 2012-11-09 12:39 |
In the root of the clone, with the doc already built in Doc/build (no need to rebuild it), do:
hg import --no-c http://bugs.python.org/file27887/issue4965.diff
cp Doc/tools/sphinxext/static/basic.css Doc/build/html/_static/basic.css
firefox file://`pwd`/Doc/build/html/library/multiprocessing.html
|
msg199609 - (view) |
Author: Georg Brandl (georg.brandl) *  |
Date: 2013-10-12 18:14 |
See http://sphinx-doc.org/latest/ for my preferred solution.
|
msg199650 - (view) |
Author: Ezio Melotti (ezio.melotti) *  |
Date: 2013-10-13 02:01 |
I stole the code from that page and adapted it to integrate better with sidebar.js (and make it a bit more efficient).
To test the new patch, in the root of the clone, with the doc already built in Doc/build (no need to rebuild it), do:
hg import --no-c http://bugs.python.org/file32072/issue4965-2.diff
cp Doc/tools/sphinxext/static/sidebar.js Doc/build/html/_static/sidebar.js
cp Doc/tools/sphinxext/static/basic.css Doc/build/html/_static/basic.css
firefox file://`pwd`/Doc/build/html/library/multiprocessing.html
|
msg199651 - (view) |
Author: Ned Deily (ned.deily) *  |
Date: 2013-10-13 03:00 |
The patch seems to work well with both Safari 6.0.5 and Firefox 25.0 on OS X 10.8. Nice improvement.
|
msg199659 - (view) |
Author: Georg Brandl (georg.brandl) *  |
Date: 2013-10-13 07:00 |
Very nice, thanks for porting this. One minor nit: when I close the sidebar, then scroll and then reopen it, it does not immediately update the sidebar position, only when scrolling again.
|
msg199660 - (view) |
Author: Georg Brandl (georg.brandl) *  |
Date: 2013-10-13 07:00 |
You said you made it a bit more efficient; is this python-specific or can it be ported back to Sphinx?
|
msg199719 - (view) |
Author: Ezio Melotti (ezio.melotti) *  |
Date: 2013-10-13 15:08 |
> One minor nit: when I close the sidebar, then scroll and then reopen
> it, it does not immediately update the sidebar position, only when
> scrolling again.
I'll look into it.
> You said you made it a bit more efficient; is this python-specific
> or can it be ported back to Sphinx?
Some could be backported:
* $('.sphinxsidebarwrapper'), $(window), and $('.sphinxsidebar') are re-evaluated every time the user scrolls. In sidebar.js I already had references to these, so I reused them; in Sphinx you can move them outside the .scroll();
* The original code used $(window).innerHeight(), but the code in sidebar.js used window.innerHeight if available or $(window).height() if not. I kept the latter, however I'm not sure that is the best option;
* $(document) and sidebar_height could also be calculated once at the beginning, since they shouldn't change, but I haven't done it in my patch;
* In the patch I also renamed a few variables to be more clear;
* The fix in #4711 could also be backported.
|
msg199779 - (view) |
Author: Ezio Melotti (ezio.melotti) *  |
Date: 2013-10-13 19:49 |
Updated patch should fix the nit and factors out $(document) from the scrolling function. Tested on Firefox and Chromium.
|
msg199780 - (view) |
Author: Georg Brandl (georg.brandl) *  |
Date: 2013-10-13 19:52 |
LGTM.
|
msg199825 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2013-10-14 00:00 |
New changeset 3bb34d370871 by Ezio Melotti in branch '3.3':
#4965: Implement intelligent scrolling of the sidebar in the docs.
http://hg.python.org/cpython/rev/3bb34d370871
New changeset 8d916ea12efb by Ezio Melotti in branch 'default':
#4965: merge with 3.3.
http://hg.python.org/cpython/rev/8d916ea12efb
|
msg199826 - (view) |
Author: Ezio Melotti (ezio.melotti) *  |
Date: 2013-10-14 00:04 |
I committed the patch on 3.3/3.x. I'm willing to port the patch on 2.7 too, however sidebar.js is not in Doc/tools/sphinxext/static/ but in Doc/tools/sphinx/themes/default/static/, which is not under version control. How do you suggest to proceed?
|
msg199836 - (view) |
Author: Georg Brandl (georg.brandl) *  |
Date: 2013-10-14 04:27 |
You'll have to put a copy in sphinxext/static.
|
msg199947 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2013-10-14 20:01 |
New changeset d7ebe03fa752 by Ezio Melotti in branch '2.7':
#4965: Implement intelligent scrolling of the sidebar in the docs.
http://hg.python.org/cpython/rev/d7ebe03fa752
|
msg199956 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2013-10-14 21:24 |
Could you please make a scrolling more smooth? Or at least optional.
|
msg199971 - (view) |
Author: Ezio Melotti (ezio.melotti) *  |
Date: 2013-10-15 01:18 |
I've looked into it, and I found that:
1) the scroll event can be triggered dozens of times per second;
2) sidebarwrapper.css(...) causes a browser repaint/reflow, which is slow;
Optimizing the function doesn't seem like a good solution, so I tried to throttle it so that the position is updated at most once every 100ms (i.e. at 10fps max). On Firefox this shows that about 2-6 redraws are skipped but, as a side-effect, the sidebar might result a few pixels off due to the skipped redraws at the end (this doesn't seem noticeable though).
If the value is increased over 100ms these problems start being noticeable.
FTR there are more complex solutions but for now I preferred to keep it simple. These links contain other techniques (involving timers/timeouts):
* https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/window-scroll-event.html
* http://underscorejs.org/docs/underscore.html#section-66 and http://underscorejs.org/#throttle
Serhiy, can you try to apply the patch and fiddle a bit with it to see if you notice any improvement? You can try to change 100 with a lower or higher value, or do last_call = new Date() at the end of scroll_sidebar(). You might also have to remove the calls to console.log() if they create problems on your browser.
Remember that after each change you have to do:
cp Doc/tools/sphinxext/static/sidebar.js Doc/build/html/_static/sidebar.js
and refresh the page to see the results.
|
msg201489 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2013-10-27 20:08 |
I don't notice any improvement. :(
|
msg201974 - (view) |
Author: Ezio Melotti (ezio.melotti) *  |
Date: 2013-11-02 14:45 |
I'm going to close this as fixed then.
If other people report problems I can always apply the patch and/or try to figure out something else.
|
|
Date |
User |
Action |
Args |
2022-04-11 14:56:44 | admin | set | github: 49215 |
2013-11-02 14:45:39 | ezio.melotti | set | status: open -> closed resolution: fixed messages:
+ msg201974
stage: commit review -> resolved |
2013-10-27 20:08:39 | serhiy.storchaka | set | messages:
+ msg201489 |
2013-10-15 01:18:37 | ezio.melotti | set | files:
+ issue4965-throttle.diff
messages:
+ msg199971 |
2013-10-14 21:24:32 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages:
+ msg199956
|
2013-10-14 20:01:33 | python-dev | set | messages:
+ msg199947 |
2013-10-14 04:27:05 | georg.brandl | set | messages:
+ msg199836 |
2013-10-14 00:04:49 | ezio.melotti | set | messages:
+ msg199826 stage: patch review -> commit review |
2013-10-14 00:00:16 | python-dev | set | nosy:
+ python-dev messages:
+ msg199825
|
2013-10-13 19:52:17 | georg.brandl | set | messages:
+ msg199780 |
2013-10-13 19:49:32 | ezio.melotti | set | files:
+ issue4965-3.diff
messages:
+ msg199779 |
2013-10-13 15:08:11 | ezio.melotti | set | messages:
+ msg199719 |
2013-10-13 07:00:59 | georg.brandl | set | messages:
+ msg199660 |
2013-10-13 07:00:07 | georg.brandl | set | messages:
+ msg199659 |
2013-10-13 03:00:36 | ned.deily | set | nosy:
+ ned.deily messages:
+ msg199651
|
2013-10-13 02:01:22 | ezio.melotti | set | messages:
+ msg199650 |
2013-10-13 01:58:55 | ezio.melotti | set | files:
+ issue4965-2.diff |
2013-10-12 18:14:17 | georg.brandl | set | messages:
+ msg199609 |
2013-05-01 12:02:36 | ezio.melotti | set | versions:
+ Python 3.4, - Python 3.2 |
2013-01-22 12:44:49 | ezio.melotti | set | keywords:
+ easy stage: patch review versions:
- Python 3.1 |
2012-11-09 12:39:12 | ezio.melotti | set | messages:
+ msg175230 |
2012-11-04 23:31:54 | ezio.melotti | set | files:
+ issue4965.diff keywords:
+ patch messages:
+ msg174843
|
2011-03-09 02:26:36 | terry.reedy | set | versions:
+ Python 3.3 |
2010-08-07 18:36:28 | terry.reedy | set | versions:
- Python 2.6 |
2010-07-10 22:59:45 | terry.reedy | set | versions:
+ Python 3.2, - Python 3.0 |
2009-07-01 11:55:12 | ezio.melotti | set | priority: normal assignee: georg.brandl -> ezio.melotti |
2009-07-01 10:20:12 | ezio.melotti | set | assignee: ezio.melotti -> georg.brandl superseder: Wide literals in the table of contents overflow in documentation messages:
+ msg89971 stage: needs patch -> (no value) |
2009-07-01 09:03:39 | ezio.melotti | set | assignee: georg.brandl -> ezio.melotti messages:
+ msg89966 stage: needs patch |
2009-02-06 22:08:26 | ezio.melotti | set | nosy:
+ ezio.melotti messages:
+ msg81306 |
2009-02-06 21:53:43 | georg.brandl | set | messages:
+ msg81302 |
2009-01-24 06:56:04 | orsenthil | set | nosy:
+ orsenthil messages:
+ msg80437 |
2009-01-16 23:30:32 | terry.reedy | create | |