Skip to content

fix(sidebar): render nested subpages as details#654

Open
LeoMcA wants to merge 1 commit intomainfrom
sidebar-nested-details
Open

fix(sidebar): render nested subpages as details#654
LeoMcA wants to merge 1 commit intomainfrom
sidebar-nested-details

Conversation

@LeoMcA
Copy link
Copy Markdown
Member

@LeoMcA LeoMcA commented Apr 29, 2026

Relates to: #642

Currently pages defined in a sidebar with:

type: listSubPages
depth: 2
nested: true

Render as a nested list, but with no details elements. This results in some weird rendering:

e.g. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta

image

https://developer.mozilla.org/en-US/docs/Glossary/Boolean

image

With this change, those render to <details> elements, like so:

image

and:

image

This is particularly important for the sidebar changes proposed in #642:

Without this change:

image

With this change:

image

@github-actions
Copy link
Copy Markdown
Contributor

23dacd5 was deployed to: https://rari-pr654.review.mdn.allizom.net/

@Rumyra
Copy link
Copy Markdown

Rumyra commented Apr 29, 2026

lgtm @LeoMcA

@Rumyra Rumyra added needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. and removed needs content decision labels Apr 29, 2026
@caugner
Copy link
Copy Markdown
Contributor

caugner commented Apr 29, 2026

Hm, this is weird:

Took: 17.039215321s - 0 changes in 0 of 14380 files (0.0%)

Copy link
Copy Markdown
Contributor

@caugner caugner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial pass. Is there a chance to add a unit test?

)?;
out.push_str("</summary><ol>");
out.push_str(&sub_pages_out);
out.push_str("</ol></details></li>");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could this be a separate function with a self-documenting name like write_li_with_details?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants