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

Click twice on opening button #336

Closed
luigidallavalle opened this issue Mar 11, 2015 · 1 comment
Closed

Click twice on opening button #336

luigidallavalle opened this issue Mar 11, 2015 · 1 comment

Comments

@luigidallavalle
Copy link

Hi,
we have the same situation that the "QWERTY Password" demo represents: the keyboard is opened by clicking on a button. (except that it has custom layout and opens in the screen center, but i think it's not relevant)
If you
click the button (the keyboard appears) -> click again the button (the keyboard disappears), click again the button, then the keyboard will never appear again.

I noticed that in the demo, the log is always stating that the keyboard is visible, even when it's disappearing due to the second button click.
I tried with both FF and Chrome.
Any one else is exepriencing tha same behaviour?

Thanks in advance,
Luigi

@Mottie
Copy link
Owner

Mottie commented Mar 11, 2015

Hi Luigi!

Hmm, that is interesting.

The problem is not the same as in issue #333 where clicking on the button a second time makes the keyboard flicker by opening the keyboard a second time. This is because the keyboard has the stayOpen option set to true.

In this case, you just need to check if the keyboard is already open, then close it if it is:

$('#passwd').click(function(){
    var kb = $('.qwerty:eq(1)').getkeyboard();
    // close the keyboard if the keyboard is visible and the button is clicked a second time
    if ( kb.isOpen ) {
        kb.close();
    } else {
        kb.reveal();
    }
});

I'll update the demo, and hopefully this fixes the issues you are having.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants