You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Glossary URLs with anchor link no longer jump to definitions #90492
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:
assignee=Noneclosed_at=Nonecreated_at=<Date2022-01-10.17:20:52.535>labels= ['3.11', 'type-bug', '3.10', 'docs']
title='Glossary URLs with anchor link no longer jump to definitions'updated_at=<Date2022-01-11.04:50:58.978>user='https://github.com/treyhunner'
Opening either of those links in Chrome or Firefox on my machine results in the glossary page being opened without any scrolling (the top of the glossary page is shown rather than the LBYL definition).
The EAFP term does link to #term-LBYL instead of the old #term-lbyl.
It looks like the capitalization changed. The search doesn't seem to know that though (the LBYL glossary link at the top is broken): https://docs.python.org/3/search.html?q=lbyl
I would vote for changing the link back to lowercase rather than changing the search to link to the new URL. Otherwise links to specific glossary terms scattered around the internet will all link to the top of the glossary page instead.
I would vote for changing the link back to lowercase rather than changing the search to link to the new URL. Otherwise links to specific glossary terms scattered around the internet will all link to the top of the glossary page instead.
The anchors are generated by Sphinx, so unless we implement our own hacks here, that would have to be a Sphinx change; since that was probably from back when they added support for case-sensitive glossary entries several years and 2-3 major versions ago (since 3.9 was built with Sphinx 2.4.4, 3.10 was built with 3.4.3 and 5.x is the current stable branch), so it would break other users who have adapted by now. To note, until Sphinx 3.5.0 and Python 3.11, the glossary anchors weren't copyable (there was no link or icon in the UI), people had to construct them manually, so the backward compatibility breakage is less concerning than it would have been (though still not ideal).
The immediate fix on the CPython side would be to have our custom search functionality generate the correct glossary links from 3.10+. From a quick look, the culprit appears to be the .lower() call here, which is what eventually gets used to construct the fragment in the JS on the custom search page template. We'd have to test it, though, and confirm that nothing else relies on it to be case-folded, but that at least should be a straightforward fix.
Activity
treyhunner commentedon Jan 10, 2022
The glossary page allows for anchor links to jump to specific definitions.
For example: https://docs.python.org/3.9/glossary.html#term-lbyl will open the glossary page with the web browser showing the LBYL at the top of the page.
This no longer works in Python 3.10 and Python 3.11 documentation.
https://docs.python.org/3.10/glossary.html#term-lbyl
https://docs.python.org/3.11/glossary.html#term-lbyl
Opening either of those links in Chrome or Firefox on my machine results in the glossary page being opened without any scrolling (the top of the glossary page is shown rather than the LBYL definition).
AlexWaygood commentedon Jan 10, 2022
Reproduced on safari on my iPad, as well.
treyhunner commentedon Jan 10, 2022
I just realized those only affects some terms.
parameter works: https://docs.python.org/3/glossary.html#term-parameter
And LBYL does work but only if LBYL was used: https://docs.python.org/3/glossary.html#term-LBYL
The EAFP term does link to #term-LBYL instead of the old #term-lbyl.
It looks like the capitalization changed. The search doesn't seem to know that though (the LBYL glossary link at the top is broken): https://docs.python.org/3/search.html?q=lbyl
I would vote for changing the link back to lowercase rather than changing the search to link to the new URL. Otherwise links to specific glossary terms scattered around the internet will all link to the top of the glossary page instead.
CAM-Gerlach commentedon Aug 1, 2022
The anchors are generated by Sphinx, so unless we implement our own hacks here, that would have to be a Sphinx change; since that was probably from back when they added support for case-sensitive glossary entries several years and 2-3 major versions ago (since 3.9 was built with Sphinx 2.4.4, 3.10 was built with 3.4.3 and 5.x is the current stable branch), so it would break other users who have adapted by now. To note, until Sphinx 3.5.0 and Python 3.11, the glossary anchors weren't copyable (there was no link or icon in the UI), people had to construct them manually, so the backward compatibility breakage is less concerning than it would have been (though still not ideal).
The immediate fix on the CPython side would be to have our custom search functionality generate the correct glossary links from 3.10+. From a quick look, the culprit appears to be the .lower() call here, which is what eventually gets used to construct the fragment in the JS on the custom search page template. We'd have to test it, though, and confirm that nothing else relies on it to be case-folded, but that at least should be a straightforward fix.