akzhan / jquery-keyfilter

This plugin filters keyboard input by specified regular expression.
http://akzhan.github.com/jquery-keyfilter/
37 stars 11 forks source link

Turkish keyboard problem #14

Open tolgaonbay opened 8 years ago

tolgaonbay commented 8 years ago

Hi,

We have a problem with the plugin in Turkish keyboards. Some of the special characters (e.g. #, $, @, ...) can be used even if they are filtered out in the component with a valid regex. Those characters that I mentioned are generated with an AltGr key in a Turkish layout keyboard. Some of the mappings include:

AltGr + 3 => #
AltGr + 4 => $
AltGr + Q => @
AltGr + ] => ~

For example with below definition, users can enter #, $, @ characters with the mentioned keystrokes.

<pe:keyFilter for="vkn" regEx="/[0-9]/i" preventPaste="false" />

You can look at the Turkish keyboard layout from http://ascii-table.com/keyboard.php/179

At the below line, e.ctrlKey and e.altKey are both true for the specified key strokes. I don't think it is the right fix, but if I remove the if condition from the script, it works like a charm.

https://github.com/akzhan/jquery-keyfilter/blob/master/jquery.keyfilter.js#L134

Thanks