docs: use readthedocs search addons for cross-project search in main search bar - #320
Merged
Merged
Conversation
Member
|
Ooh that might be working! |
Contributor
Author
|
Yeah, finally getting somewhere 🙄 |
Contributor
Author
|
Sorry, I'm pushing incremental work here because the only way to test is the readthedocs PR builds... |
Problem: sphinx_immaterial performs single-project client-side search with no way to reach flux-framework subproject documentation. RTD Addons (enabled by default since October 2024) provides native cross-project search but was only accessible via the bottom-right flyout, not the top-bar search input. Override partials/search.html to render a search input that lacks sphinx_immaterial's data-md-component attributes so the theme ignores it, then dispatch the readthedocs-search-show custom event on focus/click to open the RTD Addons cross-project search modal from the header. Position the bar absolutely within .md-header__inner and center it with left:50% + translate(-50%,-50%) so it stays centered regardless of flex siblings. Falls back to sphinx_immaterial's standard search for local builds where RTD Addons is absent. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Problem: The RTD Addons search modal uses light mode regardless of the site's color scheme. CSS custom properties set on body are insufficient because the shadow DOM's :host rules override inherited values in the cascade. The .filters-title element inside the shadow root also uses a hardcoded background: rgb(252,252,252) that no external custom property could reach. Set all --readthedocs-search-* overrides directly on the readthedocs-search host element so light-DOM author styles beat :host rules. For elements with hardcoded values, inject a <style> into the shadow root when the slate scheme is active; CSS custom properties pierce the shadow boundary so the injected rule can reference --readthedocs-search-content-background-color. A MutationObserver re-applies the style when the user toggles the color scheme. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
|
Ok, this seems to be working now. The cross-project search seems to be working in the RTD PR preview as well. |
Contributor
Merge Queue Status
This pull request spent 25 seconds in the queue, including 3 seconds running CI. Required conditions to merge
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supposedly if we stop trying to implement a special search box ourselves, the RTD search "Addons" feature will override the site search with its own search box which supports searching all subprojects.
Again, to test I need to create a PR so a preview will be built.
Fixes #318