Skip to content

Conversation

@ehuss
Copy link
Contributor

@ehuss ehuss commented Oct 21, 2025

This fixes an issue when folding is enabled. The folding was not properly hiding the sub-chapters because it was assuming it could hide the next list element. However, the heading nav was the next list element, so the remaining chapters remained visible.

The solution required some deeper changes to how the chapters were organized in the sidebar. Instead of nested chapters being a list element sibling, the nested chapter's ol is now a child of its parent chapter. This makes it much easier to just hide everything without regard of the exact sibling order.

This required wrapping the chapter title and the toggle chevron inside a span so that the flex layout could be localized to just those elements, and allow the following ol elements to lay out regularly.

Closes #2880

This fixes an issue when folding is enabled. The folding was not
properly hiding the sub-chapters because it was assuming it could hide
the next list element. However, the heading nav was the next list
element, so the remaining chapters remained visible.

The solution required some deeper changes to how the chapters were
organized in the sidebar. Instead of nested chapters being a list
element *sibling*, the nested chapter's `ol` is now a *child* of its
parent chapter. This makes it much easier to just hide everything
without regard of the exact sibling order.

This required wrapping the chapter title and the toggle chevron inside a
span so that the flex layout could be localized to just those elements,
and allow the following `ol` elements to lay out regularly.

Closes rust-lang#2880
@rustbot rustbot added the S-waiting-on-review Status: waiting on a review label Oct 21, 2025
@ehuss ehuss enabled auto-merge October 21, 2025 00:32
@ehuss ehuss added this pull request to the merge queue Oct 21, 2025
Merged via the queue into rust-lang:master with commit 7b7dee4 Oct 21, 2025
15 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: waiting on a review label Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sub-chapters are not collapsed when having headings

2 participants