That is another good point, never connect a charger while it is on. Heck I never even plug mine in till it's connected to the battery. The last thing you want is a spark around a battery.
If you connect or disconnect a battery charger from a battery on a motorcycle or a car while the charger is "On" it creates a voltage surge that can hit well over 10,000 volts. (If you saw a spark it was at least over 500-700 volts). The more the battery is discharged and/or the higher the battery charger setting, the more likely you are to create this voltage surge, and the higher the voltage of the surge will be. 9,999 times out of 10,000 nothing bad happens. This is because the voltage surge (like a wave in water) may dissipate enough by the time it gets to any sensitive electronics that no damage is done . . . but that one time in 10,000 . . . the devil has his due. Think about how many times you have ridden over broken glass (didn't see it in time, accident scene you had to ride through, whatever) . . . and didn't get a flat tire . . . and think about how many times you've probably ridden over broken glass and didn't even know about it, and didn't get a flat tire . . . doesn't mean you can't get a flat tire from broken glass . . . sometimes you're the winshield . . . and sometimes you're the bug. Sorry to hear that your speedometer took a hit.
10,000 volt surge on a battery charger,thats a new one one on me.I've spent the last 39yrs of my life working with just about every kind of battery/battery charger under the sun.Nicad,nife,lead acid,wet and sealed.100 Amp chargers charging banks of 800 AH cells, although I've gotten into some nasty power supplys that you might read 10,000 volts.Guess I better watch what I'm doing.