Attach sidebar-close handler to current-page links#1588
Attach sidebar-close handler to current-page links#1588jayaddison wants to merge 3 commits intoreadthedocs:masterfrom
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This is intended primarily to resolve a problem with `singlehtml` documentation projects when viewed on narrow (typically mobile) displays. Under those circumstances, the `.current` CSS selector does not match any sidebar menu elements, because there is no logical notion of a 'current' page in `singlehtml` -- every item is on the same page. Therefore this change proposes an alternative way to identify sidebar links that are 'current' -- it checks for anchors that have an `href` beginning with the query-string fragment identifier (`#`). This is intended to be compatible with both `singlehtml` and `html` project builds. It depends upon sphinx-doc/sphinx#12551
2e97557 to
9d30f9e
Compare
|
Rebased against Test results when self-building the Before (buggy) buggy.mp4After (fixed) fixed.mp4 |
|
Note: based on the dependency deprecation history for the project, I'd anticipate that the very earliest that this could be merged would likely be for a 4.0 release. |
|
I'm uncomfortable with the way that I offensively dismissed what I felt to be a spammy issue request about AI in an unrelated FOSS project thread yesterday (2026-02-14). I mention this in case you'd prefer not to accept my contributions; however you are still welcome to. I don't use AI myself and would like not to be critical of those who do, but I was angry. |
This is intended primarily to resolve a problem with
singlehtmldocumentation projects when viewed on narrow (typically mobile) displays.Under those circumstances, the
.currentCSS selector does not match any sidebar menu elements, because there is no logical notion of a 'current' page insinglehtml-- every item is on the same page.Therefore this change proposes an alternative way to identify sidebar links that are 'current' -- it checks for anchors that have an
hrefbeginning with the query-string fragment identifier (#).This is intended to be compatible with both
singlehtmlandhtmlproject builds. It depends upon sphinx-doc/sphinx#12551Resolves #880.