Attach sidebar-close handler to current-page links #1588
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 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
href
beginning with the query-string fragment identifier (#
).This is intended to be compatible with both
singlehtml
andhtml
project builds. It depends upon sphinx-doc/sphinx#12551Resolves #880.