Fixes issues with backspace and delete and simplified key handling code, reducing duplication by adding a mapping function between Legacy and Standards KeyboardEvent handlers.