From 6ab34f49f04068310407c641a9e70cb9aa9f311d Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Thu, 1 Dec 2022 13:44:28 -0700 Subject: [PATCH 1/2] rustdoc: clean up button-hiding mobile CSS --- src/librustdoc/html/static/css/rustdoc.css | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 02a51312e8f84..a65f7258ee62f 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -1660,10 +1660,6 @@ in storage.js content: "Since "; } - #copy-path { - display: none; - } - /* Hide the logo and item name from the sidebar. Those are displayed in the mobile-topbar instead. */ .sidebar .sidebar-logo, @@ -1797,8 +1793,8 @@ in storage.js border-bottom: 1px solid; } - /* We don't display the help button on mobile devices. */ - #help-button { + /* We don't display these buttons on mobile devices. */ + #copy-path, #help-button { display: none; } From efdec6d09373e279ff4c12ec6ab47fbe6c21aa3d Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Thu, 1 Dec 2022 14:24:33 -0700 Subject: [PATCH 2/2] rustdoc: clean up help and settings button CSS The old version of this code specified a bunch of different numbers that had to line up just right to get the size it wanted. This version uses flexbox centering, specifies the font size, and lets the browser figure out the rest of the layout automatically. --- src/librustdoc/html/static/css/rustdoc.css | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index a65f7258ee62f..101ffbdbbba03 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -911,6 +911,7 @@ so that we can apply CSS-filters to change the arrow color in themes */ .popover { position: absolute; + top: 100%; right: 0; z-index: 2; display: block; @@ -1360,22 +1361,24 @@ a.test-arrow:hover { } #settings-menu, #help-button { margin-left: 4px; - outline: none; + display: flex; } #settings-menu > a, #help-button > a, #copy-path { width: 33px; - line-height: 1.5; } #settings-menu > a, #help-button > a { - padding: 5px; - height: 100%; - display: block; + display: flex; + align-items: center; + justify-content: center; background-color: var(--button-background-color); border: 1px solid var(--border-color); border-radius: 2px; color: var(--settings-button-color); + /* Rare exception to specifying font sizes in rem. Since this is acting + as an icon, it's okay to specify their sizes in pixels. */ + font-size: 20px; } #settings-menu > a:hover, #settings-menu > a:focus, @@ -1411,14 +1414,6 @@ a.test-arrow:hover { animation: rotating 2s linear infinite; } -#help-button > a { - text-align: center; - /* Rare exception to specifying font sizes in rem. Since this is acting - as an icon, it's okay to specify their sizes in pixels. */ - font-size: 20px; - padding-top: 2px; -} - kbd { display: inline-block; padding: 3px 5px;