python / python-docs-theme

Sphinx theme for Python documentation
Other
75 stars 58 forks source link

Use correct block, enable built-in slash keypress #141

Closed miketheman closed 1 year ago

miketheman commented 1 year ago

Includes a commit removing a duplicate block.

When the template was made responsive, the choice was made to override the body_tag fragment. The body_tag block is a literal <body> which allows the theme developer to set properties on the body tag. See: https://github.com/sphinx-doc/sphinx/pull/4140

Instead, use the document block as documented. https://www.sphinx-doc.org/en/master/development/templating.html#blocks

Overriding the correct block places the mobile-nav section after the majority of the other HTML parts, which enables the correct function of the / keyboard shortcut.

Resolves https://github.com/python/python-docs-theme/issues/130 Closes https://github.com/python/python-docs-theme/pull/131 Closes https://github.com/python/python-docs-theme/pull/135

miketheman commented 1 year ago

@hugovk I think this one is the thing we want!

hugovk commented 1 year ago

Thanks!

Preview: https://python-docs-theme-previews--141.org.readthedocs.build/en/141/

With this, slash highlights the search box in the top right in desktop view:

image

But not the one in mobile view:

image

Which is the more useful way around.