The decreasing uncertainty in the experimental measurements of several hadronic observables related to weak processes, which in many cases is smaller than O(1%), requires theoretical calculations to include subleading corrections that were neglected so far. In this talk we present the first RBC-UKQCD lattice calculation of the isospin-breaking corrections to the ratio of leptonic decay rates of kaons and pions into muons. The inclusion of long-distance QED interactions on the lattice, evaluated using the $\mathrm{QED_L}$ prescription, produces sizeable structure-dependent finite-volume corrections. The relevant role of these effects in the high-precision determination of leptonic decay rates will be discussed.