-
Notifications
You must be signed in to change notification settings - Fork 723
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
Usability problem when showing/hiding keyboard with button #333
Comments
Hi @AZtech! Hmm, I was not able to duplicate the issue in Chrome, but I think it would be better to change the layout instead of destroying the keyboard instance every time. See if the issue continues with this code (demo): $.keyboard.layouts.custom1 = {
'default': [
'{accept}',
'a b c d e f g'
]
};
$.keyboard.layouts.custom2 = {
'default': [
'{accept}',
'1 2 3 4 5 6 7'
]
};
$('#searchField').keyboard({
openOn: null,
stayOpen: false,
alwaysOpen: false,
autoAccept: true,
appendTo: '#ds-keyboard-container #keyboard-a-container',
usePreview: false,
initialFocus: true,
layout: 'custom1',
display: {
'accept': '×',
'intro': 'klawiatura znaków specjalnych',
'lock': 'Caps lock'
},
});
// specjalna klawiatura ekranowa / klawiatura ekranowa
$('#keyboard-a, #keyboard-b').click(function () {
var kb = $('#searchField').getkeyboard();
// change layout based on link ID
kb.options.layout = this.id === 'keyboard-a' ? 'custom1' : 'custom2';
kb.reveal();
}); |
First of all thanks for hint. The solution with switching layouts it something what I was looking for to simplify JS code :) |
Instead of unbinding the links, I think maybe the next easiest thing to do would be to add an overlay. In the demo I made the overlay background darker, but it can be transparent as well. CSS .overlay {
width: 100%;
height: 100%;
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.3);
z-index: 100;
} Script (snippet to add) visible: function(){
$('<div class="overlay"/>')
.click(function(){
$(this).remove();
return false;
})
.appendTo('#ds-keyboard-container');
} |
Thanks! It's much better! It still has one drawback but it is better than flickering keyboard. |
Hmm, ok, I'll see what I can do... |
Ok, try this (demo): // specjalna klawiatura ekranowa / klawiatura ekranowa
$('#keyboard-a, #keyboard-b').click(function () {
var kb = $('#searchField').getkeyboard();
// change layout based on link ID
kb.options.layout = this.id === 'keyboard-a' ? 'custom1' : 'custom2';
// open keyboard if layout is different, or time from it last closing is > 200 ms
if (kb.last.layout !== kb.options.layout || (new Date().getTime() - kb.last.eventTime) > 200) {
kb.reveal();
}
}); Basically, I added code to include:
This update is available in the master branch; I haven't made a release version yet. |
Work perfect! Thank you! |
I have two keyboards bind to the same search field. Keyboards are open by clicking on link. The keyboard has to be closed if user clicks outside of keyboard and/or accept button or clicks again on the link. My problem is that clicking on the link sometimes causes thath keyboard is flickering instead of beeing hidden.
Please run following fiddle on Chrome and click on keyboard A link, then click outside to hide keyboard and then click again link A. Keyboard doesn't appear.
See the code https://jsfiddle.net/aztechowski/1hwwstyt/8/.
I think the reason is that at the end of destroy method method init() is called. This caused that keyboard id recreated even I call the destroy method. I was expecting that $('#searchField').getkeyboard() will return me "undefined" after destroy but due to initialziation it returns object.
P.S. Similar behaviour you can see for example "international" from here: http://mottie.github.io/Keyboard/index.html.
The text was updated successfully, but these errors were encountered: