It's illegal in the UK and will invalidate your insurance cover and leave you open to prosecution. Until 18 months ago I worked in the motorcycle insurance industry for 23 years in the UK, so I do feel somewhat qualified to state this as fact (in the UK). Another modification that invalidates insurance here is the sealing of spoked wheels to enable tubeless tyres to be fitted. I have seen a few YT videos of this being done in other countries and it may well be perfectly fine. But over here its a no-no. As with anything insurance-related, you will be fine all the time you don't need to claim. But the day you do, if it's spotted by the insurance assessor, you will be in a whole world of trouble. I've seen a 50/50 fault incident with a motorcycle and car result in prosecution for the bike owner due to just this sort of modification, resulting in a lengthy licence ban and a huge fine/damages award to the car driver all because the assessor spotted this problem, which in all probability had nothing to do with the cause of the accident.
As always in life, we all need to find our own way, and you may feel different. But for me it's not a great idea to risk so much. My bike licence and my beer fund are too precious