sparksuite / simplemde-markdown-editor

A simple, beautiful, and embeddable JavaScript Markdown editor. Delightful editing for beginners and experts alike. Features built-in autosaving and spell checking.
https://simplemde.com
MIT License
9.87k stars 1.13k forks source link

AltGr-L triggers numbered list #616

Open PaszaVonPomiot opened 7 years ago

PaszaVonPomiot commented 7 years ago

Hi,

The issue is that when you use some keyboard layouts like Polish (programmers) or Romanian (Moldavian) and want to type "Ł" letter (which is typed by pressing Right Alt + L) the SimpleMDE triggers numbered list instead.

Steps to reproduce

  1. In Windows language preferences add "Polish (Programmers)" and enable it
  2. Open https://simplemde.com/ and select one paragraph
  3. Press right ALT-L (numbered list will be triggered)
  4. Do the same in notepad to see that it will type "Ł" letter which is correct behavior

Solution proposition

TryGhost/Ghost#8687

Thanks!

JohnONolan commented 7 years ago

Copying over the solution proposal:


I won't be able to help with js as I'm not a programmer but hopefuly this will be useful. It appears that SimpleMDE has the same issue. First we have to understand that in JavaScript we use two parameters to determine which modifier key has been pressed and those are:

If we press AltGr using standard English (US) keyboard then all browsers will detect: Key 'Alt' is down. Location: Right

However if we press AltGr using Polish (programmers) or Romanian keyboards then js will detect:

So the solution I think will be to check not only for key that is being pressed but also for its location. In our case the numbered list should be triggered by:

Ctrl + Alt (only left) +L

Useful links

Snippet to test keypresses Numeric key locations

Thanks!

papcorp commented 5 years ago

have the same issues, so no progress?