Closed mjosephdelrosario closed 9 years ago
It is a bug in the api. I would investigate it soon. Still, pull requests are welcome!
Great plugin port! Btw, for the issue above, i just used lodash and angular's jqlite for fixing it(within self.attachVki() function). But also looking for forward for the official fix.
VKI_addListener(elem, 'click', function(e) {
if (self.VKI_target == this) {
e = e || event;
if (e.stopPropagation) { e.stopPropagation(); } else e.cancelBubble = true;
// For triggering close to non-focused virtual keyboard elements
angular.forEach( angular.element(document).find('input'), function(value) {
var inputChild = angular.element(value);
if(_.isEqual('true', inputChild.attr('VKI_attached')) && !_.isEqual(elem, value)) {
inputChild.triggerHandler('close');
}
});
}
return false;
}, false);
if (self.VKI_isMoz)
elem.addEventListener('blur', function() { this.setAttribute('_scrollTop', this.scrollTop); }, false);
// Attach close event handler.
angular.element(elem).bind('close', function(){ self.VKI_close(); });
VKI_addListener(document.documentElement, 'click', function(e) { self.VKI_close(); }, false);
Added these:
// For finding all input type elements with attached VKI
angular.forEach( angular.element(document).find('input'), function(value) {
var inputChild = angular.element(value);
if(_.isEqual('true', inputChild.attr('VKI_attached')) && !_.isEqual(elem, value)) {
inputChild.triggerHandler('close');
}
});
// For attaching a close event handler
angular.element(elem).bind('close', function(){ self.VKI_close(); });
Thank you havocdrake!
I am using textarea widgets with the virtual keyboard - so I added one more angular.foreach to detach keyboards from the textarea widgets:
angular.forEach( angular.element(document).find('textarea'), function(value) {
var inputChild = angular.element(value);
if(_.isEqual('true', inputChild.attr('VKI_attached')) && !_.isEqual(elem, value)) {
inputChild.triggerHandler('close');
}
});
Note this is not the official fix -- But I am glad that those hack-fix could help :>
At line 241
VKI_addListener(document.documentElement, 'click', function(e) { self.VKI_close(); }, false);
The close function is being called when clicked on blank space in the page. But not if clicked on another input or other elements that could take focus too e.g. labels
.
Add a listener for blur event as well?: VKI_addListener(elem, 'blur', function(e) { if (self.VKItarget == this) { e = e || event; if (e.stopPropagation) { e.stopPropagation(); } else e.cancelBubble = true; // For triggering close to non-focused virtual keyboard elements angular.forEach( angular.element(document).find('input'), function(value) { var inputChild = angular.element(value); if(.isEqual('true', inputChild.attr('VKIattached')) && !.isEqual(elem, value)) { inputChild.triggerHandler('close'); } }); } return false; }, false);
solved in version 0.4.2
I downloaded version 0.4.2 and issue still happens. (using chrome) and I also get an error: Uncaught RangeError: Maximum call stack size exceeded
I am having a problem of overlapping 'virtual-keyboard's when clicking multiple input-types without closing the previous ones -- how could i auto close it?