about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-11-22 00:01:11 +0100
committerGitHub <noreply@github.com>2022-11-22 00:01:11 +0100
commit78cbe9ce84775c3fa73ac4735aa3ef99b8fa5656 (patch)
tree7eccf25c00162480d91f9a6db9bd06dce8373d1f
parent9cefd9dd29a918e26f10df08eaef401cd5d651e4 (diff)
parent709e9dea919fb54e62185b5e20e03353b42c7b6d (diff)
downloadrust-78cbe9ce84775c3fa73ac4735aa3ef99b8fa5656.tar.gz
rust-78cbe9ce84775c3fa73ac4735aa3ef99b8fa5656.zip
Rollup merge of #104663 - notriddle:notriddle/button-cursor, r=GuillaumeGomez
rustdoc: factor out common button CSS
-rw-r--r--src/librustdoc/html/static/css/rustdoc.css12
-rw-r--r--src/test/rustdoc-gui/cursor.goml24
2 files changed, 28 insertions, 8 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index accd6093069..26c1eb5389f 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -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;
@@ -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;
@@ -1345,7 +1345,6 @@ a.test-arrow:hover {
 	font-weight: bold;
 	background: none;
 	color: inherit;
-	cursor: pointer;
 	text-align: center;
 	border: none;
 	outline: none;
@@ -1367,7 +1366,6 @@ a.test-arrow:hover {
 
 #settings-menu > a, #help-button > a, #copy-path {
 	width: 33px;
-	cursor: pointer;
 	line-height: 1.5;
 }
 
@@ -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;
 	}
@@ -1967,7 +1964,6 @@ in storage.js
 	position: absolute;
 	top: 0.25em;
 	z-index: 1;
-	cursor: pointer;
 	padding: 0;
 	background: none;
 	border: none;
diff --git a/src/test/rustdoc-gui/cursor.goml b/src/test/rustdoc-gui/cursor.goml
new file mode 100644
index 00000000000..b2e91cb81fb
--- /dev/null
+++ b/src/test/rustdoc-gui/cursor.goml
@@ -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"})