Closed
Description
Any inline code in a link in the first paragraph of the documentation of an implementation of a trait with at least one item isn't clickable.
MRE:
struct Type;
trait Trait {
const ITEM: () = ();
}
/// [`i32`]
///
/// [`i32`]
impl Trait for Type {}
I expected to see this happen:
In the documentation generated by cargo doc, both links should be clickable.
Instead, this happened:
Unless JS is disabled, clicking on the top link does nothing.
Meta
rustc --version
:
rustc 1.88.0-nightly (d5b4c2e4f 2025-04-02)
The cause seems to be this event listener, which is added to the impl's summary and doesn't account for the fact that inline code is allowed inside Markdown links:
onEachLazy(document.querySelectorAll(".toggle > summary:not(.hideme)"), el => {
// @ts-expect-error
el.addEventListener("click", e => {
if (e.target.tagName !== "SUMMARY" && e.target.tagName !== "A") {
e.preventDefault();
}
});
});