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: factor out common button CSS #104663

Merged
merged 2 commits into from
Nov 22, 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
12 changes: 4 additions & 8 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -290,20 +290,21 @@ p:last-child {
button {
/* Buttons on Safari have different default padding than other platforms. Make them the same. */
padding: 1px 6px;
/* Opinionated tweak: use pointer cursor as clickability signifier. */
cursor: pointer;
}

/* end tweaks for normalize.css 8 */

button#toggle-all-docs {
padding: 0;
background: none;
border: none;
cursor: pointer;
/* iOS button gradient: https://stackoverflow.com/q/5438567 */
-webkit-appearance: none;
opacity: 1;
}

/* end tweaks for normalize.css 8 */

.rustdoc {
display: flex;
flex-direction: row;
Expand Down Expand Up @@ -1305,7 +1306,6 @@ a.test-arrow:hover {
#titles > button {
text-align: center;
font-size: 1.125rem;
cursor: pointer;
border: 0;
border-top: 2px solid;
flex: 1;
Expand Down Expand Up @@ -1345,7 +1345,6 @@ a.test-arrow:hover {
font-weight: bold;
background: none;
color: inherit;
cursor: pointer;
text-align: center;
border: none;
outline: none;
Expand All @@ -1367,7 +1366,6 @@ a.test-arrow:hover {

#settings-menu > a, #help-button > a, #copy-path {
width: 33px;
cursor: pointer;
line-height: 1.5;
}

Expand Down Expand Up @@ -1796,7 +1794,6 @@ in storage.js
z-index: 10;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
cursor: pointer;
border: 1px solid;
border-left: 0;
}
Expand Down Expand Up @@ -1967,7 +1964,6 @@ in storage.js
position: absolute;
top: 0.25em;
z-index: 1;
cursor: pointer;
padding: 0;
background: none;
border: none;
Expand Down
24 changes: 24 additions & 0 deletions src/test/rustdoc-gui/cursor.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// This test ensures that several clickable items actually have the pointer cursor.
goto: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html"

// the `[+]/[-]` button
assert-css: ("#toggle-all-docs", {"cursor": "pointer"})

// the button next to the path header
assert-css: ("#copy-path", {"cursor": "pointer"})

// the search tabs
write: (".search-input", "Foo")
// To be SURE that the search will be run.
press-key: 'Enter'
// Waiting for the search results to appear...
wait-for: "#titles"
assert-css: ("#titles > button", {"cursor": "pointer"})

// mobile sidebar toggle button
size: (500, 700)
assert-css: (".sidebar-menu-toggle", {"cursor": "pointer"})

// the sidebar toggle button on the source code pages
goto: "file://" + |DOC_PATH| + "/src/lib2/lib.rs.html"
assert-css: ("#sidebar-toggle > button", {"cursor": "pointer"})