Skip to content

fix: Correct version selector to show current version as selected#614

Merged
laughingman7743 merged 1 commit intomasterfrom
fix-version-selector-selected
Oct 18, 2025
Merged

fix: Correct version selector to show current version as selected#614
laughingman7743 merged 1 commit intomasterfrom
fix-version-selector-selected

Conversation

@laughingman7743
Copy link
Member

Problem

The version selector dropdown was not showing the current version as selected. For example:

  • When viewing v3.12.2/index.html, the dropdown did not have v3.12.2 selected
  • When viewing master/index.html, the dropdown did not have master selected

Root Cause

The template was comparing item.name == current_version, which compared a string with an object. The current_version provided by sphinx-multiversion is a version object, not a string.

Solution

Changed the comparison from item.name == current_version to item == current_version to properly compare version objects.

Verification

Tested locally:

  • ✅ v3.12.2 page now shows v3.12.2 as selected in dropdown
  • ✅ master page now shows master as selected in dropdown

Changes

  • Updated docs/_templates/versioning.html to use correct version object comparison

🤖 Generated with Claude Code

Fix version selector dropdown to properly select the currently displayed
version by comparing version objects instead of comparing version name
with current_version string.

Changed comparison from `item.name == current_version` to
`item == current_version` to properly match the current version object.

Now:
- v3.12.2 page shows v3.12.2 as selected
- master page shows master as selected

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@laughingman7743 laughingman7743 marked this pull request as ready for review October 18, 2025 07:35
@laughingman7743 laughingman7743 merged commit f05ff4d into master Oct 18, 2025
5 checks passed
@laughingman7743 laughingman7743 deleted the fix-version-selector-selected branch October 18, 2025 07:54
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.

1 participant