Skip to content

Commit b426445

Browse files
committed
Auto merge of rust-lang#91188 - jsha:fix-click-items, r=Manishearth
Fix clicking on anchors inside summary tags Fixes rust-lang#91184 r? `@camelid`
2 parents 8a48b37 + 04cb0dc commit b426445

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/librustdoc/html/static/js/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ function hideThemeButtonState() {
888888

889889
onEachLazy(document.querySelectorAll(".rustdoc-toggle > summary:not(.hideme)"), function(el) {
890890
el.addEventListener("click", function(e) {
891-
if (e.target.tagName != "SUMMARY") {
891+
if (e.target.tagName != "SUMMARY" && e.target.tagName != "A") {
892892
e.preventDefault();
893893
}
894894
});

src/test/rustdoc-gui/toggle-click-deadspace.goml

+4
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ click: "h4.code-header" // This is the position of "pub" in "pub fn a_method"
66
assert-attribute: (".impl-items .rustdoc-toggle", {"open": ""})
77
click: ".impl-items .rustdoc-toggle summary::before" // This is the position of "[-]" next to that pub fn.
88
assert-attribute-false: (".impl-items .rustdoc-toggle", {"open": ""})
9+
10+
// Click the "Trait" part of "impl Trait" and verify it navigates.
11+
click: "#impl-Trait h3 a:first-of-type"
12+
assert-text: (".fqn .in-band", "Trait lib2::Trait")

0 commit comments

Comments
 (0)