Prosemirror: Cmd-Alt- modifiers not working

Created on 6 Jul 2017  路  10Comments  路  Source: ProseMirror/prosemirror

We are on PM version 0.21.0. Key modifiers Cmd-Alt- (MAC) and Ctrl-Alt- (windows) do not seems to be working. From reading the documentation it looks like they should work.

All 10 comments

Seems to work for me on Linux. Could you show what you are doing, precisely?

Ah I see issue is I am writing command as Cmd-Alt-1 and it does not works but when I write Cmd-Alt-隆 it works. Seems that I need to write key to that is generated when Alt is pressed.

Interesting. Could you see what your browser puts in the key property of the keydown event? If that's "隆", I guess yes, this is expected behavior (though it does make it hard to bind Alt-3 in a way that's portable across keyboard layouts).

Yes its "隆". I am also getting little concerned over binding to special characters - as they may not work across keyboards.

Yeah, that's not great. There is the code property which, on first glance, sounds like it would help with this, but that one ignores keyboard layouts, so when someone sets up a qwerty keyboard as azerty, it'll produce very undesirably behavior by still treating the 'a' as a 'q'. It's hard to implement a general solution for this.

The good news is that you can probably write a custom handleKeyDown function which just looks at the raw event.keyCode to do what you want here, sidestepping the keymap module.

Unfortunately, because of the dependency on KeyboardEvent.key we are stuck with workarounds like: https://bitbucket.org/atlassian/atlaskit/pull-requests/3370/fix-component-fixing-keyboard-shortcuts/diff#Lpackages/editor-core/test/browser/plugins/block-type/index.tsF381

Hm, that's quite bad. I found that I had a workaround for this issue already when it comes to shift. Attached patch extends it to also kick in when alt or meta/cmd are held. Does that help with your problem?

Hi Marijn,

This patch does seems to work well for us, thx. Would it be possible for you to make a release of prosemirror-keymap for us.

Great. I've released prosemirror-keymap 0.22.1

Thanks @marijnh 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SamyPesse picture SamyPesse  路  3Comments

marijnh picture marijnh  路  6Comments

forresto picture forresto  路  3Comments

stevemao picture stevemao  路  5Comments

theefer picture theefer  路  6Comments