guardian / scribe

DEPRECATED: A rich text editor framework for the web platform
http://guardian.github.io/scribe/
Apache License 2.0
3.51k stars 245 forks source link

Can't type polish letter ż with "Polish Pro" keyboard layout on Windows #448

Closed danburzo closed 8 years ago

danburzo commented 8 years ago

In short, Right Alt + Z on a Polish Pro keyboard layout will trigger an event with:

{
  ctrlKey: true,
  altKey: true,
  ...
}

which is caught by the undo manager.

This article from Medium Engineering goes into more details on why this happens.

I've forked Scribe and will be providing a Pull Request with the fix. Can't currently install Scribe tests because of this: https://github.com/guardian/scribe-test-harness/issues/26

danburzo commented 8 years ago

Anyways, the fix is in https://github.com/guardian/scribe/blob/a62186405271aa52c131ab8313a4f5f027096d6d/src/plugins/core/commands/undo.js#L22.

The line becomes: if (! event.shiftKey && (event.metaKey || (event.ctrlKey && !event.altKey)) && event.keyCode === 90) {

(same should be done to redo.js)

paperboyo commented 8 years ago

+1

Maybe it could/should be solved more systemically? There are many more IMEs that use AltGr (that Windows interprets as Ctrl + Alt), including UK IME...

danburzo commented 8 years ago

@paperboyo I can't find any other references to event.ctrlKey in the code which might preventDefault() except the two in Undo/Redo, so I'm assuming all other AltGr combos should work by default.

paperboyo commented 8 years ago

Thanks, @danburzo!