Skip to content

Conversation

@reakaleek
Copy link
Member

@reakaleek reakaleek commented Jan 8, 2026

Problem

In assembler builds, navigation folders with the same relative path from different documentation sets were generating duplicate HTML id attributes. This breaks the HTML specification and causes accessibility issues with <label for> and <input id> pairings in the navigation template (_TocTreeNav.cshtml).

Example: Two docsets both have a getting-started folder. When assembled, both folders received the same ID, causing invalid HTML.

Root Cause

Navigation node IDs were generated using only the relative path:

  • FolderNavigation: ShortId.Create(parentPath)
  • VirtualFileNavigation: ShortId.Create(RelativePathToDocumentationSet)
  • TableOfContentsNavigation: ShortId.Create(parentPath)

In assembler builds, multiple docsets can have folders with identical relative paths (e.g., both have getting-started), resulting in duplicate IDs.

Solution

Changed ID generation to include both the navigation root identifier and the URL:

  • ShortId.Create(NavigationRoot.Id, Index.Url)

This ensures uniqueness because:

  • NavigationRoot.Id is unique per docset (based on project name)
  • Index.Url is unique within each docset

Testing

Added a test NavigationNodeIdsAreUniqueAcrossDocsets that:

  1. Creates two docsets with identical folder structures
  2. Assembles them using SiteNavigation (production code)
  3. Verifies all node IDs are unique using production YieldAll() traversal

The test follows TDD: it fails with the original code and passes with the fix.

@reakaleek reakaleek requested a review from a team as a code owner January 8, 2026 09:44
@reakaleek reakaleek requested review from Mpdreamz and cotti January 8, 2026 09:44
@reakaleek reakaleek self-assigned this Jan 8, 2026
@reakaleek reakaleek added the fix label Jan 8, 2026
@reakaleek reakaleek merged commit f3603e6 into main Jan 8, 2026
38 of 41 checks passed
@reakaleek reakaleek deleted the feature/fix-navigation-dropdown branch January 8, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants