Skip to content

Add white-space: nowrap to links in the sidebar #93286

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 1 commit into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,10 @@ nav.sub {
overflow: hidden;
}

.sidebar-links a {
white-space: nowrap;
}

.sidebar h2 {
border-bottom: none;
font-weight: 500;
Expand Down
4 changes: 4 additions & 0 deletions src/test/rustdoc-gui/sidebar.goml
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,7 @@ assert-text: (".sidebar > .location", "Module sub_sub_module")
assert-false: ".sidebar-elems .crate"
assert-text: (".sidebar-elems .items > ul > li:nth-child(1)", "Functions")
assert-text: ("#functions + .item-table .item-left > a", "foo")

// Links to trait implementations in the sidebar should not wrap even if they are long.
goto: file://|DOC_PATH|/lib2/struct.HasALongTraitWithParams.html
assert-property: (".sidebar-links a", {"offsetHeight": 29})
6 changes: 6 additions & 0 deletions src/test/rustdoc-gui/src/lib2/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,9 @@ pub mod too_long {
pub fn foo(&self) {}
}
}

pub struct HasALongTraitWithParams {}

pub trait LongTraitWithParamsBananaBananaBanana<T> {}

impl LongTraitWithParamsBananaBananaBanana<usize> for HasALongTraitWithParams {}