Fix clicking on anchors inside summary tags.

This commit is contained in:
Jacob Hoffman-Andrews 2021-11-24 10:43:58 -08:00
parent c6a7ca196a
commit 04cb0dc8a9
2 changed files with 5 additions and 1 deletions

View file

@ -888,7 +888,7 @@ function hideThemeButtonState() {
onEachLazy(document.querySelectorAll(".rustdoc-toggle > summary:not(.hideme)"), function(el) {
el.addEventListener("click", function(e) {
if (e.target.tagName != "SUMMARY") {
if (e.target.tagName != "SUMMARY" && e.target.tagName != "A") {
e.preventDefault();
}
});

View file

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