Skip to content

Commit

Permalink
Clicking accept in IE will now close the keyboard. Fixes #72
Browse files Browse the repository at this point in the history
  • Loading branch information
Mottie committed Jun 17, 2012
1 parent a99fc40 commit 3d097e9
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions js/jquery.keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -736,12 +736,16 @@ $.keyboard = function(el, options){
.trigger( (o.alwaysOpen) ? '' : 'beforeClose.keyboard', [ base, base.el, (accepted || false) ] )
.val( val )
.scrollTop( base.el.scrollHeight )
.blur()
.trigger( ((accepted || false) ? 'accepted.keyboard' : 'canceled.keyboard'), [ base, base.el ] )
.trigger( (o.alwaysOpen) ? 'inactive.keyboard' : 'hidden.keyboard', [ base, base.el ] );
.trigger( (o.alwaysOpen) ? 'inactive.keyboard' : 'hidden.keyboard', [ base, base.el ] )
.blur();
if (o.openOn) {
// rebind input focus
base.$el.bind( o.openOn + '.keyboard', function(){ base.focusOn(); });
// rebind input focus - delayed to fix IE issue #72
base.timer = setTimeout(function(){
base.$el.bind( o.openOn + '.keyboard', function(){ base.focusOn(); });
// remove focus from element (needed for IE since blur doesn't seem to work)
if ($(':focus')[0] === base.el) { base.$el.blur(); }
}, 100);
}
if (!o.alwaysOpen) {
base.$keyboard.hide();
Expand Down Expand Up @@ -1002,7 +1006,7 @@ $.keyboard = function(el, options){
base.destroy = function() {
$(document).unbind('mousedown.keyboard keyup.keyboard');
if (base.$keyboard) { base.$keyboard.remove(); }
var unb = $.trim(o.openOn + ' accepted beforeClose blur canceled change contextmenu hidden initialized keydown keypress keyup visible').split(' ').join('.keyboard ');
var unb = $.trim(o.openOn + ' accepted beforeClose canceled change contextmenu hidden initialized keydown keypress keyup visible').split(' ').join('.keyboard ');
base.$el
.removeClass('ui-keyboard-input ui-keyboard-lockedinput ui-keyboard-placeholder ui-keyboard-notallowed ui-keyboard-always-open ' + o.css.input)
.removeAttr('aria-haspopup')
Expand Down

0 comments on commit 3d097e9

Please sign in to comment.