-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
Problem
There is a function in doctools.js:
fixFirefoxAnchorBug : function() {
if (document.location.hash)
window.setTimeout(function() {
document.location.href += '';
}, 10);
}This function was supposed to fix an anchor bug in Firefox. It used to have a condition of $.browser, so it will only be applied to Firefox; but now this function is removed in JQuery so it's removed here as well (#1709). 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)
- Open a link with hash (anchor), e.g. https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str
- Scroll away from the anchor position.
- Click any external link (means the link that is not an anchor of current page).
- 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. Also, since Sphinx doc website is using the old theme, it doesn't have this problem either: try http://www.sphinx-doc.org/en/stable/tutorial.html#running-the-build and repeat the STR.
Comments
Please keep in mind the Firefox anchor bug we're talking about here will only happen if the anchor is assigned with <section id>: it doesn't have any bug if you merely want to jump to certain element with id, such as <div id="xxx">. From my observation we don't really use <section id>, so I don't even know if this function is really necessary to begin with.