Undo Redo broken with Caps Lock on Website Demo

Looking at a previous issue, https://github.com/ProseMirror/prosemirror/issues/895, I realized that the keymap in the example setup for undo-ing Mod-z does not work when caps lock is on.

Based on that issue, it seems that one has to define a Mod-Z as well. Is there another workaround besides registering Mod-[lowercase alphabetical] and Mod-[uppercase alphabetical] repeatedly (maybe by using event.getModifierState('CapsLock') in prosemirror-keymap to differentiate between a Mod-Z due to shift-key against a capslock)?

The other thing is that when caps lock is on, Shift-Mod-z which is the redo command somehow triggers an undo command instead.

On Chrome and Windows 10.

Edit: Oops, forgot to mention I’m seeing this on https://prosemirror.net/.

The problem is that there is no reliable way to ‘downcase’ a key event’s key information even if we check for caps lock, since that depends on keyboard layout, which the script doesn’t know anything about. It is my experience that workarounds like this produce more problems and lead to more and more layers of workarounds. So I think having a simple definition of how key binding definitions work (modifiers + event.key) and sticking to it is the best approach, even if annoying in cases like this.

Would you know why Shift-Mod-z with caps-lock results in a undo behavior that’s normally binded to Mod-z? Is there a workaround like Shift-Mod-Z that should be bounded to redo as well?

You can debug the prosemirror source where it takes the state of the shiftKey and other state from the event or you can look at something like http://www.keycode.info (which would be nicer if it gave you the various key states from the event). Anyway it’s related to what Marijn mentioned. In Safari the event.key is “Z” when the caps lock is on regardless of the shift key being down or not. In Chrome it looks like the event.key is “Z” when the capslock is on without the shift key being down but when the capslock is on and the shift key is down the key is “z” so I’d guess that the shiftKey state is false so the inputrules won’t match that key.