This happens when you listen to and then improperly handle keyboard events.
Somebody probably just copied a script from w3schools and smashed their face into it for a few hours until it did some approximation of what they might have maybe wanted it to do.
Unfortunately, the buckshot approach to software development leaves a lot to be desired. Especially when you start with such a horrible original product as w3schools.