[rustdoc] Only generate search DOM elements if the search is actually needed - #160639
Open
GuillaumeGomez wants to merge 3 commits into
Open
[rustdoc] Only generate search DOM elements if the search is actually needed#160639GuillaumeGomez wants to merge 3 commits into
GuillaumeGomez wants to merge 3 commits into
Conversation
Collaborator
|
Some changes occurred in HTML/CSS/JS. |
GuillaumeGomez
commented
Aug 6, 2026
| @@ -16,6 +17,7 @@ define-function: ("collapsed-from-search", [], block { | |||
| // Then we collapse the section again... | |||
| set-property: ("#implementations-list .implementors-toggle", {"open": "false"}) | |||
| // Then we run the search. | |||
| call-function: ("open-search", {}) | |||
Member
Author
There was a problem hiding this comment.
Ah that was my original "quest": looking at fixing the new flakyness which happened in #159593 (comment). ^^'
GuillaumeGomez
commented
Aug 6, 2026
| @@ -53,7 +53,7 @@ define-function: ( | |||
| "#src-sidebar details[open] > .files a:not(.selected):focus", | |||
| {"color": |color_hover|, "background-color": |background_hover|}, | |||
| ) | |||
| focus: ".search-input" | |||
| focus: "#search-button" | |||
Member
Author
There was a problem hiding this comment.
In this file, we use focus to "focus away" from the current element. Since search-input isn't available anymore, I just pick another item on the page.
Contributor
There was a problem hiding this comment.
adding a comment like "// focus something else to unfocus" seems like it would improve the readability of that test, then.
Member
Author
There was a problem hiding this comment.
Good point, gonna add comments.
This comment has been minimized.
This comment has been minimized.
GuillaumeGomez
force-pushed
the
search-dom
branch
from
August 6, 2026 14:07
24284c5 to
977669b
Compare
Member
Author
|
Added the missing Typescript type definition update and CI is now happy. |
Member
Author
|
Added comments as suggested for clarification. |
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.
I realized that we were generating the search DOM elements (everything contained into
#search) all the times, even when there is no search query parameters in the URL. That seems unnecessary so I reworked the JS a bit to remove that.r? @lolbinarycat