Skip to content

Replace patched Material bundle with a hook-based version selector - #6743

Open
dprotaso wants to merge 5 commits into
knative:mainfrom
dprotaso:simplify-version-selector
Open

dprotaso wants to merge 5 commits into
knative:mainfrom
dprotaso:simplify-version-selector

Conversation

@dprotaso

@dprotaso dprotaso commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Replace the vendored Material JavaScript bundle used for Knative's directory-based version selector with upstream Material assets and a small hook/template implementation.

This is a focused follow-up to #6722. Its scope is limited to:

  1. Remove patched Material JavaScript.
  2. Introduce a hook-based documentation version selector.

No multi-version local-preview preparation, hot-reload tooling, or dependency-aware incremental builds are included. Those remain on the separate development branch.

Proposed Changes

  • Remove the patched bundle, custom directory provider, and inline rewriting of Material's __config JSON. Inherit the installed theme's normal JavaScript and asset configuration.
  • Build version links from the existing versions.json manifest and rendered page/anchor data using a MkDocs hook.
  • Render an accessible native dropdown with Material styling, normal-weight version text, keyboard/outside-click dismissal, and an opaque popup above the navigation tabs.
  • Preserve the same page, query string, and valid fragment when switching versions; fall back to the selected version's homepage when that page does not exist. Hide the selector on unversioned pages; show (Pre-release) even in single-version deploy previews.
  • Generate the manifest before rendering so the hook can read it; MkDocs copies it into the site without changing its public format or URL. Release assembly and directory layout otherwise remain unchanged.

Validation

  • ./hack/mkdocs.sh build --strict against current main.
  • Strict multi-version fixture build.
  • Chrome checks: upstream search/assets, same-page/query/fragment switching, missing-page fallback, desktop/mobile click targets, outside-click dismissal, and hidden homepage selector.

Full multi-release assembly and registry publishing were not exercised for this PR.

@netlify

netlify Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for knative ready!

Name Link
🔨 Latest commit 39adb3e
🔍 Latest deploy log https://app.netlify.com/projects/knative/deploys/6adccfe20ca3e73eab1ba729
😎 Deploy Preview https://deploy-preview-6743--knative.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@knative-prow

knative-prow Bot commented Oct 24, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dprotaso

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 24, 2026
@dprotaso

Copy link
Copy Markdown
Member Author

/hold

@knative-prow knative-prow Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 24, 2026
@dprotaso

Copy link
Copy Markdown
Member Author

/assign @evankanderson this is ready for review. Take a look at the preview.

I added a temporary commit so it will do a full build showing the dropdowns in the netlify preview. I'll want to remove prior to merging.

@evankanderson evankanderson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is much better than what I did, thank you!

Comment thread netlify.toml Outdated
[context.deploy-preview.environment]
BUILD_VERSIONS="no"

# TEMP: exercise the version selector in PR #6743; remove before merging.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this need to be removed at this point?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'd keep it because of netlify getting rate limited by github breaks our deploy builds

@evankanderson

Copy link
Copy Markdown
Member

/hold

@dprotaso
dprotaso force-pushed the simplify-version-selector branch from cc518c9 to 39adb3e Compare October 24, 2026 15:33
@dprotaso

Copy link
Copy Markdown
Member Author

/hold cancel

I removed the TEMP commit now

@knative-prow knative-prow Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 24, 2026

This branch has not been deployed

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants