-
Notifications
You must be signed in to change notification settings - Fork 724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Want to programmatically click a keyboard button. #156
Comments
My meta-notation got awkwardly filtered out above. So here's an explicit example of my code: $("[ data-value='3' ]").trigger("click.keyboard"); |
Yep. I should have read a little deeper into the library's code ... The solution is to either override the default keyBinding usability setting ('mousedown touchstart') to include 'click', or simply borrow that default setting as is as shown below: Examples: $("[ data-value='3' ]").trigger("mousedown.keyboard");
$("[ data-value='3' ]").trigger("touchstart.keyboard"); |
Hi toketeeman! LOL I'm glad I could help ;) Actually if you look at the typing extension, I did it slightly different because I wanted the key to "look" like it was pressed. // mouseover the key, add the text directly, then mouseout on the key
base.typing_simulateKey = function(el,txt){
var e = el.length;
if (e) { el.filter(':visible').trigger('mouseenter.keyboard'); }
base.typing_timer = setTimeout(function(){
if (e) { setTimeout(function(){ el.trigger('mouseleave.keyboard'); }, base.typing_options.delay/3); }
if (!base.isVisible) { return; }
if (!base.typing_event) {
base.insertText(txt);
base.checkCombos();
}
}, base.typing_options.delay/3);
};
The reason I did it this way is because sometimes the text sent to the typing extension may contain keys that don't exist within the virtual keyboard. |
With a keyboard all set up and working, I would like to "type" on it from another input device instead of clicking the mouse or using touch. My code captures the device's character stream and then attempts to click the appropriate keyboard button while the keyboard is visible.
I have tried these patterns:
and I verified that
$("[data-value='<key-display-name>']")
does deliver the correct keyboard button.But apparently this does not fire the key-handling routines that normally execute.
So what am I missing here?
The text was updated successfully, but these errors were encountered: