Add white-space: nowrap to links in the sidebar

We already have overflow: hidden on these links, but if there is a
possibility to wrap, they will wrap. This happens in particular for trait
implementations because the punctuation (`<>, `) introduces opportunities
for breaks. That produces inconsistent UI. Fix it by forcing them not to
wrap.
This commit is contained in:
Jacob Hoffman-Andrews 2022-01-24 20:19:09 -08:00
parent e7825f2b69
commit abffd4af08
3 changed files with 14 additions and 0 deletions

View file

@ -484,6 +484,10 @@ nav.sub {
overflow: hidden;
}
.sidebar-links a {
white-space: nowrap;
}
.sidebar h2 {
border-bottom: none;
font-weight: 500;

View file

@ -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})

View file

@ -114,3 +114,9 @@ pub mod too_long {
pub fn foo(&self) {}
}
}
pub struct HasALongTraitWithParams {}
pub trait LongTraitWithParamsBananaBananaBanana<T> {}
impl LongTraitWithParamsBananaBananaBanana<usize> for HasALongTraitWithParams {}