To reproduce the issue: On Mac OS, change the keyboard settings to add Japanese. From the options, choose Romaji. When entering keystrokes into a restricted input, the keydown, input and keyup events fire, but keypress is missing.
So we can simply move the keypress logic to the beginning of the input event. (putting it at the end of keydown adds some funky visual behavior as things are unformatted and reformatted quickly)
To reproduce the issue: On Mac OS, change the keyboard settings to add Japanese. From the options, choose Romaji. When entering keystrokes into a restricted input, the
keydown
,input
andkeyup
events fire, butkeypress
is missing.According to MDN,
keypress
is deprecated: https://developer.mozilla.org/en-US/docs/Web/API/Document/keypress_eventSo we can simply move the
keypress
logic to the beginning of theinput
event. (putting it at the end of keydown adds some funky visual behavior as things are unformatted and reformatted quickly)