Rollup merge of #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``
This commit is contained in:
commit
828f7c895a
@ -1878,9 +1878,15 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm
|
||||
if (elem === null) {
|
||||
return;
|
||||
}
|
||||
const buttons = elem.querySelector(".button-holder");
|
||||
let buttons = elem.querySelector(".button-holder");
|
||||
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");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user