Originally posted by Jeremy Satterfield in his blog, jQuery plugins and on Snipplr. Currently maintained by Mottie.
Demo)
Features (-
An on-screen virtual keyboard embedded within the browser window which will popup when a specified entry field is focused.
-
The user can then type and preview their input before Accepting or Canceling.
-
Add custom keyboard layouts easily.
-
Add up to four standard key sets to each layout that use the shift and alt keys (default, shift, alt and alt-shift).
-
Add any number of optional modifier keys (meta keys) to add more key sets.
-
Each meta key set also includes the shift, alt and alt-shift keysets - New in version 1.8.9.
-
Position the keyboard in any location around the element, or target another element on the page.
-
Easily modify the key text to any language or symbol.
-
Allow direct input or lock the preview window.
-
Set a maximum length to the inputted content.
-
Scroll through the other key sets using the mouse wheel while hovering over a key to bypass the need to use alt, shift or meta keys.
-
Easily type in characters with diacritics. Here are some default combination examples - it is possible to add more.
- ' + vowel ( vowel with acute accent, e.g. ' + e = é )
- ` + vowel ( vowel with grave accent, e.g., ` + e = è )
- " + vowel ( vowel with diaeresis, e.g., " + e = ë )
- ^ + vowel ( vowel with circumflex accent, e.g., ^ + e = ê )
- ~ + certain letters ( letter with tilde, e.g. ~ + n = ñ, ~ + o = õ )
-
Enable, disable or add more diacritic functionality as desired.
-
Use callbacks and event triggers that occur when the keyboard is open or closed and when the content has changed, been accepted or canceled.
-
ARIA support (may not be fully implemented)
-
As jQuery UI is a dependancy, this plugin's styling will automatically match the selected jQuery UI theme with the exception of the required CSS found in the keyboard.css file.
-
Built in watermarking. It emulates HTML5's placeholder, if the browser doesn't support it.
-
Typing extension allows you to simulate typing into the keyboard for demo purposes or to assist user input.
-
Autocomplete extension will integrate this keyboard plugin with jQuery UI's autocomplete widget.
-
Multiple region specific keyboard layouts included in a separate directory. This is a work in progress and slowly growing.
Documentation
Moved to the Wiki Pages: Home | FAQ | Setup | Usage | Options ( Layout, Language, Useability, Actions ) | Methods | Theme | Log
To Do
- Waiting for requests :)
- Add more regional keyboard layouts.
- Add an input mask extension. I think I'll try to make it compatible with this plugin.
Known Problems
- IE and Opera:
- In a text area with multiple carriage returns, the caret positioning will be off when repositioning it with the mouse.
- Using the right and left arrow keys to navigate through a text area with multiple carriage returns is problematic. The caret doesn't behave like in other browsers when moving from one line to the next. You can always reposition the caret using the mouse.
- Opera: When pressing the tab key while inside a textarea, all browsers but Opera add the tab to the virtual keyboard textarea.
- Safari: See the QWERTY Text Area demo with a locked input. While using the virtual keyboard to type, it enters the text in backwards! This is because textareas with a "readonly" attribute always returns zero for the caret postion.
- Typing Extension:
- When pressing "Alt", the key set will change to the alt key set, but the focus will be moved to the browser menu. Pressing it quickly a second time will return the focus. This is build into the browser and it isn't possible (as far as I know) to automatically restore the window focus the first time alt is pressed.
- Holding down the Alt key and trying to type is also not possible since the Windows OS is assuming you are trying to type a shortcut key to access the browser menu. You can still click the keys in the alt key set with the mouse.
- Simulated typing on the keyboard breaks when the CapLock is on. Still looking for a cross-browser solution.
Dependencies
- Required
- jQuery 1.4.3+
- jQuery UI Positioning Utility
- jQuery UI CSS (can be customized)
- jQuery caret (included with source)
- Optional
- jQuery mousewheel plugin - allows using mousewheel to scroll through other key sets
- jQuery keyboard typing extension - simulate typing on the virtual keyboard
- jQuery keyboard autocomplete extension - for use with jQuery UI autocomplete
Licensing
- Keyboard code: MIT License for all versions.
- Caret code by C. F., Wong (Cloudgen): MIT License
- Layouts files: Most are under WTFPL, unless the file itself specifies otherwise.
Change Log
Only the latest changes will be shown below, see the wiki log to view older versions.
Version 1.10 (7/9/2012)
- Added
{next}
and{prev}
action keys which makes switching between input/textareas easier. - Added the ability to make some action keys get the button action class applied
- The action class (options.css.buttonAction) makes the button stand out like the
{accept}
,{cancel}
&{enter}
keys. - Add double exclamation point to the custom key name
{custom!!}
or to any built-in action key except:{accept}
,{alt}
,{bksp}
,{cancel}
,{combo}
,{dec}
,{enter}
,{meta#}
,{shift}
,{sign}
,{sp:#}
,{space}
or{tab}
. - See a demo named "Custom Action Key" in the More Demos section of the home page wiki documentation.
- The action class (options.css.buttonAction) makes the button stand out like the
- Added
stopAtEnd
option which whentrue
prevents the default switch input function from wrapping to the first or last element. Useful when used in combination with the new{next}
and{prev}
action keys. - Modified diacritic key modification code:
- As before, diacritic (dead) key combinations will be ignored when the
{combo}
key is inactive. - But now, in modern browsers, when the
{combo}
key is reactivated, only the two characters immediately to the left of the caret will be evaluated for key combinations instead of the entire input string. - Older IE (IE8 and older) will continue to check and update the entire input string.
- Change made to make dead keys more useful as described in issue #79.
- As before, diacritic (dead) key combinations will be ignored when the
- Fixed
stayOpen
function not allowing keyboards to open/close with multiple keyboards. Hopefully this new method will squash all the problems withstayOpen
andalwaysOpen
options. Fixes issue #82.
Version 1.9.21 (6/18/2012)
- IE should now behave like other browsers when switching inputs; clicking on another input with a keyboard open will now switch immediately instead of requiring a second click.
Version 1.9.20 (6/17/2012)
- Added Latvian layout. Thanks to Ivars via email.
Version 1.9.19 (6/17/2012)
- Modified script to add "ui-keyboard-autoaccepted" class name to the original input if the content was autoaccepted. Discussed in issue #66.
- Added
resetDefault
option which whentrue
will force the keyset to reset to the default when the keyboard becomes visible. - Mulitple keyboards that are always open will not keep focus properly. Fixes issues #69, #73 and #75.
- Fixed carriage return issue in a textarea in IE8 (hopefully). Thanks to blookie for reporting it and providing a fix in issue #71.
- IE should now close the keyboard after clicking accept. Base element will no longer maintain focus. Fix for issue #72.
- Reveal will no longer unbind all events when
openOn
is empty. Fix for issue #74. - Fixed locked keyboard input not allowing opening the keyboard a second time. Fix for issue #77.
- Fixed
stayOpen
option not working at all. - Added Hebrew layout. Thanks to Ofir Klinger for contributing the work!
- Added a keyboard object as a variable in the typing callback function. Probably not necessary, but added anyway :P
Version 1.9.18 (5/13/2012)
- Fixed an issue of the input clearing when
usePreview
isfalse
andalwaysOpen
istrue
. Brought up in issue #37.
Version 1.9.17 (5/8/2012)
- Added Turkish layouts. Thanks to barisaydinoglu!
Version 1.9.16 (4/30/2012)
- Caret position is now better retained in older IE. Fix for issue #61.
- Invalid input should now revert back to the last valid input instead of breaking the keyboard. Fix for issue #62.
- The repeating key obtained by holding down the mouse on a virtual key can now be disabled by setting the
repeatRate
to0
(zero). Fix for issue #63. - Clicking on a virtual keyboard key will no longer submit a form - fix for issue #64.
Version 1.9.15
- Updated Mobile demo
- Updated to jQuery Mobile version 1.1.0 RC1
- Extra demo css added because the theme selector radio buttons were not displaying properly due to some issues with the data-attributes showing "[Object object]" instead of true or false. I'm not sure why, and don't have the time to investigate.
- Fixed a problem where keyboards with
alwaysOpen
andautoAccept
set totrue
would keep focus on the input when clicking outside the input. Fix for issue #59. - Fixed an issue with
tabNavigation
not working properly. Also, discovered thattabindex="0"
should not be used. Fix for issue #60.
Version 1.9.14
- Multiple synchronized keyboards with
alwaysOpen
andautoAccept
set totrue
should now switch properly. Fix for issue #58.
Version 1.9.13
- Multiple synchronized keyboards with
alwaysOpen
set totrue
should now switch properly. Fix for issue #58.
Version 1.9.12.1
- Updated jquery.mousewheel.js, as the it was only scrolling in one direction.