Skip to content

rustdoc: clicking a link inside the help popover does not work #106390

Closed
@ardislu

Description

@ardislu

Steps to reproduce the issue:

  1. In any Rust project, create a new documentation website and open it:
cargo doc --open
  1. Make sure you're viewing the page on a device with a screen width greater than 700px. Click the "help" icon on the top right to open the help popover:
    image
  2. Click the anchor link "the rustdoc book"

Expected result: I am able to follow the anchor link, and the tab is redirected to the https://doc.rust-lang.org/rustdoc/ site

Actual result: nothing happens


It looks like the issue is happening due to L1043-L1045 in src/librustdoc/html/static/js/main.js:

container.onclick = event => {
    event.preventDefault();
};

Where container is the popover <div> element, which the click event on the child <a> element bubbles up to. I tested deleting this event listener directly within the browser and it appears to fix the issue.

I don't think deleting this event listener would cause any regressions because there is already no default behavior when you click on a plain <div>. However, I'm not sure what the full context was around adding this event listener in the first place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-uiArea: Rustdoc UI (generated HTML)C-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions