Skip to content

Fix search results display #85551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 24, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions src/librustdoc/html/static/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -768,16 +768,29 @@ a {
display: block;
}

.search-results a {
.search-results > a {
/* A little margin ensures the browser's outlining of focused links has room to display. */
margin-left: 2px;
margin-right: 2px;
display: block;
}

.result-name {
.search-results > a > div {
display: flex;
}

.search-results > a > div > div {
Copy link
Contributor

Choose a reason for hiding this comment

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

When we have a series of direct-parent selectors like that, we're creating a brittle dependency on a specific structure of the DOM. It becomes hard to make a change to the code that generates search results and figure out which CSS selectors need to change.

Instead, we should add classes, or use the classes that are already here - result-name and desc (though note desc is on a span rather than a div and might not be exactly what you're looking for).

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point.

min-width: 50%;
max-width: 50%;
width: 50%;
float: left;
}

.result-name {
padding-right: 10px;
}

.result-name > span {
display: inline-block;
}

tr.result span.primitive::after {
Expand Down