Skip to content

Fix source sidebar hover in ayu theme #98502

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

Merged
merged 2 commits into from
Jun 26, 2022
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
4 changes: 2 additions & 2 deletions src/librustdoc/html/static/css/themes/ayu.css
Original file line number Diff line number Diff line change
Expand Up @@ -629,11 +629,11 @@ kbd {
color: #fff;
border-bottom-color: #5c6773;
}
div.files > a:hover, div.name:hover {
#source-sidebar div.files > a:hover, div.name:hover {
background-color: #14191f;
color: #ffb44c;
}
div.files > .selected {
#source-sidebar div.files > .selected {
background-color: #14191f;
color: #ffb44c;
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/html/static/css/themes/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -499,10 +499,10 @@ kbd {
#source-sidebar > .title {
border-bottom-color: #ccc;
}
div.files > a:hover, div.name:hover {
#source-sidebar div.files > a:hover, div.name:hover {
background-color: #444;
}
div.files > .selected {
#source-sidebar div.files > .selected {
background-color: #333;
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/html/static/css/themes/light.css
Original file line number Diff line number Diff line change
Expand Up @@ -483,10 +483,10 @@ kbd {
#source-sidebar > .title {
border-bottom-color: #ccc;
}
div.files > a:hover, div.name:hover {
#source-sidebar div.files > a:hover, div.name:hover {
background-color: #E0E0E0;
}
div.files > .selected {
#source-sidebar div.files > .selected {
background-color: #fff;
}

Expand Down
99 changes: 99 additions & 0 deletions src/test/rustdoc-gui/sidebar-source-code-display.goml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,102 @@ assert-css: (".sidebar > *:not(#sidebar-toggle)", {"visibility": "hidden", "opac
click: "#sidebar-toggle"
// Because of the transition CSS, we check by using `wait-for-css` instead of `assert-css`.
wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})

// Now we check the display of the sidebar items.
show-text: true

// First we start with the light theme.
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
reload:
// Waiting for the sidebar to be displayed...
wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
assert-css: (
"#source-sidebar .expand + .children a.selected",
{"color": "rgb(0, 0, 0)", "background-color": "rgb(255, 255, 255)"},
)
// Without hover.
assert-css: (
"#source-sidebar .expand + .children > .files a:not(.selected)",
{"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
)
// With hover.
move-cursor-to: "#source-sidebar .expand + .children > .files a:not(.selected)"
assert-css: (
"#source-sidebar .expand + .children > .files a:not(.selected)",
{"color": "rgb(0, 0, 0)", "background-color": "rgb(224, 224, 224)"},
)
// Without hover.
assert-css: (
"#source-sidebar .expand + .children .folders .name",
{"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
)
// With hover.
move-cursor-to: "#source-sidebar .expand + .children .folders .name"
assert-css: (
"#source-sidebar .expand + .children .folders .name",
{"color": "rgb(0, 0, 0)", "background-color": "rgb(224, 224, 224)"},
)

// Now with the dark theme.
local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"}
reload:
// Waiting for the sidebar to be displayed...
wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
assert-css: (
"#source-sidebar .expand + .children a.selected",
{"color": "rgb(221, 221, 221)", "background-color": "rgb(51, 51, 51)"},
)
// Without hover.
assert-css: (
"#source-sidebar .expand + .children > .files a:not(.selected)",
{"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
)
// With hover.
move-cursor-to: "#source-sidebar .expand + .children > .files a:not(.selected)"
assert-css: (
"#source-sidebar .expand + .children > .files a:not(.selected)",
{"color": "rgb(221, 221, 221)", "background-color": "rgb(68, 68, 68)"},
)
// Without hover.
assert-css: (
"#source-sidebar .expand + .children .folders .name",
{"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
)
// With hover.
move-cursor-to: "#source-sidebar .expand + .children .folders .name"
assert-css: (
"#source-sidebar .expand + .children .folders .name",
{"color": "rgb(221, 221, 221)", "background-color": "rgb(68, 68, 68)"},
)

// And finally with the ayu theme.
local-storage: {"rustdoc-theme": "ayu", "rustdoc-use-system-theme": "false"}
reload:
// Waiting for the sidebar to be displayed...
wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
assert-css: (
"#source-sidebar .expand + .children a.selected",
{"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
)
// Without hover.
assert-css: (
"#source-sidebar .expand + .children > .files a:not(.selected)",
{"color": "rgb(197, 197, 197)", "background-color": "rgba(0, 0, 0, 0)"},
)
// With hover.
move-cursor-to: "#source-sidebar .expand + .children > .files a:not(.selected)"
assert-css: (
"#source-sidebar .expand + .children > .files a:not(.selected)",
{"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
)
// Without hover.
assert-css: (
"#source-sidebar .expand + .children .folders .name",
{"color": "rgb(197, 197, 197)", "background-color": "rgba(0, 0, 0, 0)"},
)
// With hover.
move-cursor-to: "#source-sidebar .expand + .children .folders .name"
assert-css: (
"#source-sidebar .expand + .children .folders .name",
{"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
)