Skip to content

[Code scan] Render Docs dropdown subitems in the mobile menu #87

Description

@njzjz

This issue is a result of a Codex global code scan of deepmodeling/deepmodeling_sphinx at commit 156679f.

Problem

The desktop banner renders item.subitem entries under the Docs dropdown, but the mobile menu only renders the top-level items. On mobile, users cannot directly reach DeePMD-kit, DP-GEN, dpdata, DPDispatcher, ABACUS, DeepFlame, or DPTI from the banner menu.

Code references:

{
"title": "Docs",
"url": "https://docs.deepmodeling.com/",
"subitem": [
{
"title": "DeePMD-kit",
"url": "https://docs.deepmodeling.com/projects/deepmd/",
},
{"title": "DP-GEN", "url": "https://docs.deepmodeling.com/projects/dpgen/"},
{
"title": "dpdata",
"url": "https://docs.deepmodeling.com/projects/dpdata/",
},
{
"title": "DPDispatcher",
"url": "https://docs.deepmodeling.com/projects/dpdispatcher/",
},
{"title": "ABACUS", "url": "https://abacus.deepmodeling.com/"},
{"title": "DeepFlame", "url": "https://deepflame.deepmodeling.com/"},
{"title": "DPTI", "url": "https://docs.deepmodeling.com/projects/dpti/"},
],
},

<div class="main-menu">
<ul>
{% for item in items %}
<li class="{{ item.class }}">
{% if item.subitem %}
<div
id="resourcesDropdownButton"
data-toggle="resources-dropdown"
class="resources-dropdown"
>
<a
href="{{ item.url }}"
class="resource-option with-down-orange-arrow"
>
{{ item.title }}
</a>
<div class="resources-dropdown-menu">
{% for subitem in item.subitem %}
<a
class="doc-dropdown-option nav-dropdown-item"
href="{{ subitem.url }}"
>
<span class="dropdown-title">{{ subitem.title }}</span>
<p></p>
</a>
{% endfor %}
</div>
</div>
{% else %}
<a href="{{ item.url }}">{{ item.title }}</a>
{% endif %}
</li>
{% endfor %}
</ul>

<div class="mobile-main-menu-links-container">
<div class="main-menu">
<ul>
{% for item in items %}
<li>
<a href="{{ item.url }}">{{ item.title }}</a>
</li>
{% endfor %}
</ul>
</div>

Impact

The mobile navigation is functionally less complete than desktop navigation and hides the project links that are most useful from the Docs section.

Suggested fix

Render submenu items in the mobile menu as well, either as an expanded nested list under Docs or as an accessible collapsible section matching the desktop dropdown contents.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions