Search code examples
documentationpython-sphinxdocumentation-generationread-the-docs

Sphinx rtd docs dropdown only works post click


I have created an rtd themed documentation for my package using sphinx and sphinx_rtd_theme. The index.rst is as follows:

Welcome!

.. toctree::
   :maxdepth: 1
   :glob:

   src


Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

And the src file is roughly following this idea:

================
Template Project
================
.. automodule:: src
   :members:
   :undoc-members:
   :show-inheritance:

.. toctree::
   :maxdepth: 4

   features
   io
   model
   utilities

The html_theme_options is also as follows in conf.py:

html_theme_options = {
    "analytics_anonymize_ip": False,
    "logo_only": False,
    "display_version": True,
    "prev_next_buttons_location": "bottom",
    "style_external_links": False,
    "vcs_pageview_mode": "",
    # Toc options
    "collapse_navigation": True,
    "sticky_navigation": True,
    "navigation_depth": 4,
    "includehidden": True,
    "titles_only": False,
    "globaltoc_collapse": True,
    "globaltoc_maxdepth": None,
}

The problem I'm expericing right now is that, the drop down's are not working correctly. They don't show up in the sidebar, unless I click on an item that should have a dropdown button near it.

This is without dropdowns

And after I click on the sidebar link, I will go to the next file which is an opened dropdown.

Opened dropdown.

What I would like to do is that, I want to have the dropdown option since the first item. This is clunky and unintuitive.


Solution

  • According to the docs for the theme, you can set collapse_navigation = False.