Skip to content

Commit 59c9c66

Browse files
authored
Rollup merge of #90983 - GuillaumeGomez:sidebar-scrollbar, r=jsha
Make scrollbar in the sidebar always visible for visual consistency Fixes #90943. I had to add a background in `dark` and `ayu` themes, otherwise it was looking strange (like an invisible margin). So it looks like this: ![Screenshot from 2021-11-17 14-45-49](https://user-images.githubusercontent.com/3050060/142212476-18892ae0-ba4b-48e3-8c0f-4ca1dd2f851d.png) ![Screenshot from 2021-11-17 14-45-53](https://user-images.githubusercontent.com/3050060/142212482-e97b2fad-68d2-439a-b62e-b56e6ded5345.png) Sadly, I wasn't able to add a GUI test to ensure that the scrollbar was always displayed because it seems not possible in puppeteer for whatever reason... I used this method: on small pages (like `lib2/sub_mod/index.html`), comparing `.navbar`'s `clientWidth` with `offsetWidth` (the first doesn't include the sidebar in the computed amount). When checking in the browser, it works fine but in puppeteer it almost never works... In case anyone want to try to solve the bug, here is the puppeteer code: <details> More information about this: I tried another approach which was to get the element in `evaluate` directly (by calling it from `page.evaluate(() => { .. });` directly instead of `parseAssertElemProp.evaluate(e => {...});`. ```js const puppeteer = require('puppeteer'); (async () => { const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.goto("file:///path/rust/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/doc/lib2/sub_mod/index.html"); await page.waitFor(".sidebar"); let parseAssertElemProp = await page.$(".sidebar"); if (parseAssertElemProp === null) { throw '".sidebar" not found'; } await parseAssertElemProp.evaluate(e => { const parseAssertElemPropDict = {"clientWidth": "192", "offsetWidth":"200"}; for (const [parseAssertElemPropKey, parseAssertElemPropValue] of Object.entries(parseAssertElemPropDict)) { if (e[parseAssertElemPropKey] === undefined || String(e[parseAssertElemPropKey]) != parseAssertElemPropValue) { throw 'expected `' + parseAssertElemPropValue + '` for property `' + parseAssertElemPropKey + '` for selector `.sidebar`, found `' + e[parseAssertElemPropKey] + '`'; } } }).catch(e => console.error(e)); await browser.close(); })(); ``` </details> r? ``@jsha``
2 parents 7993571 + bf10c88 commit 59c9c66

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/librustdoc/html/static/css/rustdoc.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ nav.sub {
303303
left: 0;
304304
top: 0;
305305
bottom: 0;
306-
overflow: auto;
306+
overflow-y: scroll;
307307
}
308308

309309
/* Improve the scrollbar display on firefox */

src/librustdoc/html/static/css/themes/ayu.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ pre, .rustdoc.source .example-wrap {
7070

7171
/* Improve the scrollbar display on firefox */
7272
* {
73-
scrollbar-color: #5c6773 transparent;
73+
scrollbar-color: #5c6773 #24292f;
7474
}
7575

7676
.sidebar {
77-
scrollbar-color: #5c6773 transparent;
77+
scrollbar-color: #5c6773 #24292f;
7878
}
7979

8080
/* Improve the scrollbar display on webkit-based browsers */

src/librustdoc/html/static/css/themes/dark.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pre, .rustdoc.source .example-wrap {
4444
scrollbar-color: rgb(64, 65, 67) #717171;
4545
}
4646
.sidebar {
47-
scrollbar-color: rgba(32,34,37,.6) transparent;
47+
scrollbar-color: rgba(32,34,37,.6) #5a5a5a;
4848
}
4949

5050
/* Improve the scrollbar display on webkit-based browsers */

0 commit comments

Comments
 (0)