Fix code examples buttons not appearing on click on mobile
This commit is contained in:
parent
0d634185df
commit
670a78b3a7
1 changed files with 8 additions and 2 deletions
|
@ -1878,9 +1878,15 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm
|
||||||
if (elem === null) {
|
if (elem === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const buttons = elem.querySelector(".button-holder");
|
let buttons = elem.querySelector(".button-holder");
|
||||||
if (buttons === null) {
|
if (buttons === null) {
|
||||||
return;
|
// On mobile, you can't hover an element so buttons need to be created on click
|
||||||
|
// if they're not already there.
|
||||||
|
addCopyButton(event);
|
||||||
|
buttons = elem.querySelector(".button-holder");
|
||||||
|
if (buttons === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
buttons.classList.toggle("keep-visible");
|
buttons.classList.toggle("keep-visible");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue