prosemirror-keymap >= 1.1.1 broken shift handling

Created on 19 Dec 2019  路  7Comments  路  Source: ProseMirror/prosemirror

Issue details

I was just getting into an issue when redo from prosemirror-history doesn't work correctly. I've bound undo on Mod-z and redo on Shift-Mod-z. It looks like after first Shift-Mod-z, next Shift-Mod-z combination is just Mod-z, and it repeats again.

With prosemirror-keymap=1.1.0 things works correctly for me, I guess regression happened in this commit https://github.com/ProseMirror/prosemirror-keymap/commit/6fff99fa6ec7b8d34ccf881068461ae65688ac33

Steps to reproduce

Use prosemirror-keymap >= 1.1.1 and prosemirror-history, bind undo on Mod-z and redo on Shift-Mod-z. You will see that redo doesn't work correctly.

ProseMirror version

prosemirror-keymap >= 1.1.1

Affected platforms

macOS 10.15.1, Electron v6

Most helpful comment

Ah, that explains things. Thanks for following up.

Closing this, assuming the original issue had the same source.

All 7 comments

Which version of w3c-keyname are you using? And could you console.log(event.key, name) on line 2 of the function returned by keydownHandler in prosemirror-keymap, and tell me what it outputs for you?

I have the same issue. For me w3c-keyname is 2.2.1, prosemirror-keymap is 1.1.3

I have debugged this line a little and fount this:
Console output

The modifiers function ignores "Shift" key pressed if the symbol is char for me.

Really curious why it works right in example setup.

Can I help with anything else?

Just want to confirm that downgrading prosemirror-keymap to 1.1.0 fixes issue for me even though w3c-keyname stays the same 2.2.1.

name is supposed to hold "Z" for shift-cmd-z, so that's going wrong. Is it broken on all browsers or just Chrome? Which version of Chrome?

I'm very confused how release 1.1.1 is breaking this though, since that adds code _below_ the point where, given the values you show above, the handler is matched. Or maybe there's some other miscommunication鈥攚hich key binding, precisely, is being matched for you?

Is it broken on all browsers or just Chrome? Which version of Chrome?

It is Chrome only. Chrome is 79.0.3945.130, the latest for macOS.

which key binding, precisely, is being matched for you?

I have these bindings around, and I observe that both triggers when I do CMD+SHIFT+Z, first Mod-z and then Shift-Mod-z:

  'Mod-z': chainCommands(undoInputRule, undo),
  'Shift-Mod-z': redo,

I think I worked it out a little and fount that exactly this change fixes the issue:
https://github.com/marijnh/w3c-keyname/commit/7b1ad166ca829e7e57ebde289e9fcb808b02050c

I clearly experience this now: having a latest [email protected] and [email protected]
When I apply this change into my local node_modules copy, the issue fixes.

So, to me it's just enough to update w3c-keyname to 2.2.2 and issue disappears. Thanks for your time!

I'm very confused how release 1.1.1 is breaking this though

Looks like for me downgrading prosemirror-keymap to 1.1.0 actually bumped w3c-keyname to 2.2.2 and that implicitly has fixed the issue

Ah, that explains things. Thanks for following up.

Closing this, assuming the original issue had the same source.

Was this page helpful?
0 / 5 - 0 ratings