Legend cut off when plot wrapped in details html tag

Got the same problem.

I put 2 htmls in the same page, but they are in different tabs. the second (not active) seems to have a problem in the legend.

any help?