This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author fireattack
Recipients docs@python, fireattack
Date 2017-10-03.04:35:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1507005320.05.0.213398074469.issue31668@psf.upfronthosting.co.za>
In-reply-to
Content
Problem

This is a regression bug/flaw in Sphinx's doctools.js, a JS file used in its base template, and therefore got inherited to Python 3's documentation website. Python 2's documentation website is not affected because it's based on an older version of Sphinx.

There is a function in doctools.js:

/**
* workaround a firefox stupidity
* see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075
*/
fixFirefoxAnchorBug : function() {
if (document.location.hash)
window.setTimeout(function() {
document.location.href += '';
}, 10);
}


This function was supposed to fix an anchor bug in Firefox (see comment). It *used to* have a condition of $.browser outside, so it will only be applied to Firefox; but it was removed in JQuery so it was removed here as well. Therefore, this function now applies to all the browsers. Unfortunately, it causes navigating problem in Chrome now, when you use back and forward.

The problem STR (Chrome only):

1. Open a link with hash (anchor), e.g. https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str
2. Scroll away from the anchor position.
3. Click any external link (means the link that is not an anchor of current page).
4. Hit "back" button in the browser.

What happened:

When you navigating back, it doesn't go to your previous position. Instead, it goes to the anchor's location.

What it should do:

It should go to your previous position.

Ironically, it won't cause this problem in Firefox, despite it's supposed to be a fix for (a different) anchor bug in Firefox.

Comments

I reported it to Sphinx as well: https://github.com/sphinx-doc/sphinx/issues/3549 but didn't get any response so far.

Please keep in mind the Firefox anchor bug mentioned above will only happen if the anchor is assigned with <section id>. From my observation we don't really use <section> in HTML, so I don't think this workaround function is really necessary here to begin with.
History
Date User Action Args
2017-10-03 04:35:20fireattacksetrecipients: + fireattack, docs@python
2017-10-03 04:35:20fireattacksetmessageid: <1507005320.05.0.213398074469.issue31668@psf.upfronthosting.co.za>
2017-10-03 04:35:19fireattacklinkissue31668 messages
2017-10-03 04:35:18fireattackcreate