Skip to content
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

navigation with togglemode: true results in errors when accepted is emitted #724

Closed
grkblood13 opened this issue Feb 7, 2019 · 4 comments
Labels

Comments

@grkblood13
Copy link

In my keyboard configuration I'm using the navigation extension with togglemode set to true.

$('#keyboard').keyboard({
position: "center",
alwaysOpen: false
}).addNavigation({
toggleMode: true,
rowLooping: true
});

When listening for the Enter key to be pressed when hovered class is present I kick of the kb.accept() method.

// submit if virtual enter key is pressed
$.extend($.keyboard.keyaction, {
enter : function(kb) {
var _text = kb.$keyboard.find('.ui-state-hover')[0].textContent;
if (_text == 'Enter') kb.accept();
}
});

// push keyboard entry to proper field
$('#keyboard').on('accepted',function(e, keyboard, el) {
closeDialog(); // <- hide div that keyboard is present in
keyboardElm.val(el.value);
keyboardElm.focus();
keyboardElm='';
});

When I do this I get the following error:

jquery.keyboard.extension-navigation.js:120 Uncaught TypeError: base.$keyboard.toggleClass is not a function
at $.keyboard.base.checkKeys (jquery.keyboard.extension-navigation.js:120)
at HTMLInputElement. (jquery.keyboard.extension-navigation.js:105)
at HTMLInputElement.dispatch (jquery-3.2.1.min.js:3)
at HTMLInputElement.q.handle (jquery-3.2.1.min.js:3)
base.checkKeys @ jquery.keyboard.extension-navigation.js:120
(anonymous) @ jquery.keyboard.extension-navigation.js:105
dispatch @ jquery-3.2.1.min.js:3
q.handle @ jquery-3.2.1.min.js:3

@Mottie
Copy link
Owner

Mottie commented Feb 7, 2019

Hi @grkblood13!

Thanks for reporting this issue. I'll look into it.

@Mottie
Copy link
Owner

Mottie commented Feb 10, 2019

This doesn't seem to be an issue I can reproduce. Please verify that the jquery.keyboard.js file is loaded before the jquery.keyboard.extension-navigation.js file in the HTML. If that isn't the issue, then please modify this demo to show the error.

@grkblood13
Copy link
Author

I'll get around to modifying that demo within the next week. Sorry it's taking me so long.

@grkblood13
Copy link
Author

Here ya go: https://jsfiddle.net/7j9gvm8e/

@Mottie Mottie closed this as completed in a67899c Feb 20, 2019
@Mottie Mottie added the Bug label Feb 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants