Prevent clicking on a link or on a button to toggle the code example buttons visibility
This commit is contained in:
parent
e2da2fb387
commit
59cb15946d
@ -1829,10 +1829,14 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm
|
|||||||
function getExampleWrap(event) {
|
function getExampleWrap(event) {
|
||||||
let elem = event.target;
|
let elem = event.target;
|
||||||
while (!hasClass(elem, "example-wrap")) {
|
while (!hasClass(elem, "example-wrap")) {
|
||||||
elem = elem.parentElement;
|
if (elem === document.body ||
|
||||||
if (elem === document.body || hasClass(elem, "docblock")) {
|
elem.tagName === "A" ||
|
||||||
|
elem.tagName === "BUTTON" ||
|
||||||
|
hasClass(elem, "docblock")
|
||||||
|
) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
elem = elem.parentElement;
|
||||||
}
|
}
|
||||||
return elem;
|
return elem;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,12 @@ move-cursor-to: ".search-input"
|
|||||||
assert-count: (".example-wrap:not(:hover) .button-holder.keep-visible", 0)
|
assert-count: (".example-wrap:not(:hover) .button-holder.keep-visible", 0)
|
||||||
assert-css: (".example-wrap .copy-button", { "visibility": "hidden" })
|
assert-css: (".example-wrap .copy-button", { "visibility": "hidden" })
|
||||||
|
|
||||||
|
// Clicking on the "copy code" button shouldn't make the buttons stick.
|
||||||
|
click: ".example-wrap .copy-button"
|
||||||
|
move-cursor-to: ".search-input"
|
||||||
|
assert-count: (".example-wrap:not(:hover) .button-holder.keep-visible", 0)
|
||||||
|
assert-css: (".example-wrap .copy-button", { "visibility": "hidden" })
|
||||||
|
|
||||||
define-function: (
|
define-function: (
|
||||||
"check-buttons",
|
"check-buttons",
|
||||||
[theme, background, filter, filter_hover],
|
[theme, background, filter, filter_hover],
|
||||||
|
Loading…
Reference in New Issue
Block a user