Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ardislu opened this issue Jan 3, 2023 · 0 comments · Fixed by #106391
Closed

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

ardislu opened this issue Jan 3, 2023 · 0 comments · Fixed by #106391
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@ardislu
Copy link
Contributor

ardislu commented Jan 3, 2023

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.

@ardislu ardislu added the C-bug Category: This is a bug. label Jan 3, 2023
@camelid camelid added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-rustdoc-ui Area: Rustdoc UI (generated HTML) labels Jan 3, 2023
@bors bors closed this as completed in b41d81c Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants