Skip to content

Commit b41d81c

Browse files
authored
Rollup merge of #106391 - ardislu:fix-popover-child-link, r=GuillaumeGomez
rustdoc: allow popover child links to work No need to prevent default click behavior on a `<div>`, it will also disable all child click behavior. Closes #106390
2 parents 659e169 + 9792c9a commit b41d81c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

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

-3
Original file line numberDiff line numberDiff line change
@@ -1040,9 +1040,6 @@ function loadCss(cssUrl) {
10401040
help_button.appendChild(container);
10411041

10421042
container.onblur = helpBlurHandler;
1043-
container.onclick = event => {
1044-
event.preventDefault();
1045-
};
10461043
help_button.onblur = helpBlurHandler;
10471044
help_button.children[0].onblur = helpBlurHandler;
10481045
}

src/test/rustdoc-gui/help-page.goml

+9
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,12 @@ click: "#help-button > a"
6161
assert-css: ("#help", {"display": "none"})
6262
compare-elements-property-false: (".sub", "#help", ["offsetWidth"])
6363
compare-elements-position-false: (".sub", "#help", ("x"))
64+
65+
// This test ensures that the "the rustdoc book" anchor link within the help popover works.
66+
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
67+
size: (1000, 1000) // Popover only appears when the screen width is >700px.
68+
assert-false: "#help"
69+
click: "#help-button > a"
70+
click: ".popover a[href='https://doc.rust-lang.org/rustdoc/']"
71+
wait-for: 2000
72+
assert-document-property: {"URL": "https://doc.rust-lang.org/rustdoc/"}

0 commit comments

Comments
 (0)