Félix Queiruga Balado as I don't want to break what you did to solve the regression, I will let you find the "correct" way to solve this issue.
If I change the display of body from flex to block, the copy is working fine.
Another attempt was to just put:
in copyButton.js. But I did not dig further to see if it's breaking something else, at least the screen was not "shaking" when doing so.
Unfortunately when the copyButton was added, not test coverage was put in place. (I have some doubts that it's possible in HtmlUnit)