Skip to content

Commit 75ab755

Browse files
authored
Unrolled build for rust-lang#129824
Rollup merge of rust-lang#129824 - GuillaumeGomez:code-example-buttons-mobile, r=notriddle Fix code examples buttons not appearing on click on mobile When browsing docs on mobile today, I realized that the buttons didn't appear when I tapped on the code example. One issue: I have no idea how to add a regression test for this case... r? ``@notriddle``
2 parents d571ae8 + 670a78b commit 75ab755

File tree

1 file changed

+8
-2
lines changed
  • src/librustdoc/html/static/js

1 file changed

+8
-2
lines changed

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

+8-2
Original file line numberDiff line numberDiff line change
@@ -1878,9 +1878,15 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm
18781878
if (elem === null) {
18791879
return;
18801880
}
1881-
const buttons = elem.querySelector(".button-holder");
1881+
let buttons = elem.querySelector(".button-holder");
18821882
if (buttons === null) {
1883-
return;
1883+
// On mobile, you can't hover an element so buttons need to be created on click
1884+
// if they're not already there.
1885+
addCopyButton(event);
1886+
buttons = elem.querySelector(".button-holder");
1887+
if (buttons === null) {
1888+
return;
1889+
}
18841890
}
18851891
buttons.classList.toggle("keep-visible");
18861892
}

0 commit comments

Comments
 (0)