Skip to content
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

rustdoc: use tighter line height in h1 and h2 #107964

Merged
merged 1 commit into from
Feb 13, 2023
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
8 changes: 8 additions & 0 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@ h1, h2, h3, h4 {
.top-doc .docblock > h4 {
border-bottom: 1px solid var(--headings-border-bottom-color);
}
/* while line-height 1.5 is required for any "block of text",
which WCAG defines as more than one sentence, it looks weird for
very large main headers */
h1, h2 {
line-height: 1.25;
padding-top: 3px;
padding-bottom: 9px;
}
h3.code-header {
font-size: 1.125rem; /* 18px */
}
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc-gui/mobile.goml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ assert-css: (".main-heading", {
"flex-direction": "column"
})

assert-property: (".mobile-topbar h2", {"offsetHeight": 36})
assert-property: (".mobile-topbar h2", {"offsetHeight": 33})

// Note: We can't use assert-text here because the 'Since' is set by CSS and
// is therefore not part of the DOM.
Expand Down
8 changes: 4 additions & 4 deletions tests/rustdoc-gui/scrape-examples-layout.goml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ assert-property: (
store-value: (offset_y, 4)

// First with desktop
assert-position: (".scraped-example .code-wrapper", {"y": 255})
assert-position: (".scraped-example .code-wrapper .prev", {"y": 255 + |offset_y|})
assert-position: (".scraped-example .code-wrapper", {"y": 253})
assert-position: (".scraped-example .code-wrapper .prev", {"y": 253 + |offset_y|})

// Then with mobile
size: (600, 600)
assert-position: (".scraped-example .code-wrapper", {"y": 314})
assert-position: (".scraped-example .code-wrapper .prev", {"y": 314 + |offset_y|})
assert-position: (".scraped-example .code-wrapper", {"y": 308})
assert-position: (".scraped-example .code-wrapper .prev", {"y": 308 + |offset_y|})
4 changes: 2 additions & 2 deletions tests/rustdoc-gui/search-result-display.goml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ size: (900, 900)

// First we check the current width, height and position.
assert-css: ("#crate-search", {"width": "223px"})
assert-css: (".search-results-title", {"height": "44px", "width": "640px"})
assert-css: (".search-results-title", {"height": "50px", "width": "640px"})
assert-css: ("#search", {"width": "640px"})

// Then we update the text of one of the `<option>`.
Expand All @@ -33,7 +33,7 @@ text: (

// Then we compare again to confirm the height didn't change.
assert-css: ("#crate-search", {"width": "527px"})
assert-css: (".search-results-title", {"height": "44px", "width": "640px"})
assert-css: (".search-results-title", {"height": "50px", "width": "640px"})
// And we check that the `<select>` isn't bigger than its container (".search-results-title").
assert-css: ("#search", {"width": "640px"})

Expand Down
6 changes: 3 additions & 3 deletions tests/rustdoc-gui/sidebar-mobile-scroll.goml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ assert-css: (".sidebar", {"display": "block", "left": "-1000px"})

// Scroll down.
scroll-to: "//h2[@id='blanket-implementations']"
assert-window-property: {"pageYOffset": "627"}
assert-window-property: {"pageYOffset": "622"}

// Open the sidebar menu.
click: ".sidebar-menu-toggle"
Expand All @@ -21,11 +21,11 @@ assert-window-property: {"pageYOffset": "0"}
// Close the sidebar menu. Make sure the scroll position gets restored.
click: ".sidebar-menu-toggle"
wait-for-css: (".sidebar", {"left": "-1000px"})
assert-window-property: {"pageYOffset": "627"}
assert-window-property: {"pageYOffset": "622"}

// Now test that scrollability returns when the browser window is just resized.
click: ".sidebar-menu-toggle"
wait-for-css: (".sidebar", {"left": "0px"})
assert-window-property: {"pageYOffset": "0"}
size: (900, 600)
assert-window-property: {"pageYOffset": "627"}
assert-window-property: {"pageYOffset": "622"}
2 changes: 1 addition & 1 deletion tests/rustdoc-gui/sidebar-mobile.goml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ assert-property: (".mobile-topbar", {"clientHeight": "45"})
// so the target is not obscured by the topbar.
click: ".sidebar-menu-toggle"
click: ".sidebar-elems section .block li > a"
assert-position: ("#method\.must_use", {"y": 45})
assert-position: ("#method\.must_use", {"y": 46})

// Check that the bottom-most item on the sidebar menu can be scrolled fully into view.
click: ".sidebar-menu-toggle"
Expand Down