diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 4c79218f62a4dd0e58045b68a7aea7c6e4d36845..87403a8b83417d16bd1ddf283180d3289b8f5455 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -1799,8 +1799,9 @@ details.rustdoc-toggle[open] > summary.hideme::after { background-color: rgba(0,0,0,0); margin: 0; padding: 0; - padding-left: 15px; z-index: 11; + /* Reduce height slightly to account for mobile topbar. */ + height: calc(100vh - 45px); } /* The source view uses a different design for the sidebar toggle, and doesn't have a topbar, @@ -1831,7 +1832,13 @@ details.rustdoc-toggle[open] > summary.hideme::after { padding: 0.3em; padding-right: 0.6em; text-overflow: ellipsis; - overflow-x: hidden; + overflow: hidden; + white-space: nowrap; + /* Rare exception to specifying font sizes in rem. Since the topbar + height is specified in pixels, this also has to be specified in + pixels to avoid overflowing the topbar when the user sets a bigger + font size. */ + font-size: 22.4px; } .mobile-topbar .logo-container { @@ -1864,6 +1871,9 @@ details.rustdoc-toggle[open] > summary.hideme::after { .sidebar-menu-toggle { width: 45px; + /* Rare exception to specifying font sizes in rem. Since this is acting + as an icon, it's okay to specify its sizes in pixels. */ + font-size: 32px; border: none; } diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css index 5d60aca6f27cd32ec429c251334796e660d97ca3..cee45e1de39b11fb686557a0bccde8c9e55922d4 100644 --- a/src/librustdoc/html/static/css/themes/ayu.css +++ b/src/librustdoc/html/static/css/themes/ayu.css @@ -216,6 +216,7 @@ a.anchor, pre.rust a, .sidebar h2 a, .sidebar h3 a, +.mobile-topbar h2 a, .in-band a { color: #c5c5c5; } diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css index 96588af54e8fb5b015b38430c50920f30a19938c..c5817ba4e73598cf9516ff9f69c24018d2bcdd0e 100644 --- a/src/librustdoc/html/static/css/themes/dark.css +++ b/src/librustdoc/html/static/css/themes/dark.css @@ -192,6 +192,7 @@ a.anchor, pre.rust a, .sidebar h2 a, .sidebar h3 a, +.mobile-topbar h2 a, .in-band a { color: #ddd; } diff --git a/src/librustdoc/html/static/css/themes/light.css b/src/librustdoc/html/static/css/themes/light.css index edb346c23b48c7ea05b2cb6678c37f9cee4974c3..3d2cd23ae3aa8262b10bdbcbf5624712b690a55b 100644 --- a/src/librustdoc/html/static/css/themes/light.css +++ b/src/librustdoc/html/static/css/themes/light.css @@ -189,6 +189,7 @@ a.anchor, pre.rust a, .sidebar h2 a, .sidebar h3 a, +.mobile-topbar h2 a, .in-band a { color: #000; } diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index 161b95d99930e761de21ae49be2b8e41df3377ba..3c21a96cef02a4b812815bfd6db9f42de60e1e56 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -72,7 +72,7 @@ function resourcePath(basename, extension) { var mobileLocationTitle = document.querySelector(".mobile-topbar h2.location"); var locationTitle = document.querySelector(".sidebar h2.location"); if (mobileLocationTitle && locationTitle) { - mobileLocationTitle.innerText = locationTitle.innerText; + mobileLocationTitle.innerHTML = locationTitle.innerHTML; } } }()); diff --git a/src/test/rustdoc-gui/mobile.goml b/src/test/rustdoc-gui/mobile.goml index acde112392521caf3be383a9c11ce7c76d4ece7d..8f9c9248f5ff1e4edf132b60ad222a92e9c80cd4 100644 --- a/src/test/rustdoc-gui/mobile.goml +++ b/src/test/rustdoc-gui/mobile.goml @@ -2,6 +2,8 @@ goto: file://|DOC_PATH|/staged_api/struct.Foo.html size: (400, 600) +font-size: 18 + // The out-of-band info (source, stable version, collapse) should be below the // h1 when the screen gets narrow enough. assert-css: (".main-heading", { @@ -9,6 +11,8 @@ assert-css: (".main-heading", { "flex-direction": "column" }) +assert-property: (".mobile-topbar h2.location", {"offsetHeight": 45}) + // Note: We can't use assert-text here because the 'Since' is set by CSS and // is therefore not part of the DOM. assert-css: (".content .out-of-band .since::before", { "content": "\"Since \"" }) diff --git a/src/test/rustdoc-gui/sidebar-mobile.goml b/src/test/rustdoc-gui/sidebar-mobile.goml index 680822b6ecb8c075eb457b4f43ac3388e184cddd..60bcffe120beca8385c09f91fdd79427f077b9d2 100644 --- a/src/test/rustdoc-gui/sidebar-mobile.goml +++ b/src/test/rustdoc-gui/sidebar-mobile.goml @@ -35,3 +35,8 @@ assert-property: (".mobile-topbar", {"clientHeight": "45"}) click: ".sidebar-menu-toggle" click: ".sidebar-links a" assert-position: ("#method\.must_use", {"y": 45}) + +// Check that the bottom-most item on the sidebar menu can be scrolled fully into view. +click: ".sidebar-menu-toggle" +scroll-to: ".block.keyword li:nth-child(1)" +assert-position: (".block.keyword li:nth-child(1)", {"y": 542.96875}) diff --git a/src/test/rustdoc-gui/type-declation-overflow.goml b/src/test/rustdoc-gui/type-declation-overflow.goml index c35b38747dfaf087c94095046b994e79a97c4ba2..229c6d6ba6b9682f454fb5af4baa1d7b3c903d54 100644 --- a/src/test/rustdoc-gui/type-declation-overflow.goml +++ b/src/test/rustdoc-gui/type-declation-overflow.goml @@ -31,6 +31,6 @@ assert-property: (".item-decl pre", {"scrollWidth": "950"}) // On mobile: size: (600, 600) goto: file://|DOC_PATH|/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html -assert-property: (".mobile-topbar .location", {"scrollWidth": "504"}) +assert-property: (".mobile-topbar .location", {"scrollWidth": "986"}) assert-property: (".mobile-topbar .location", {"clientWidth": "504"}) assert-css: (".mobile-topbar .location", {"overflow-x": "hidden"})