Skip to content

Commit

Permalink
Prevent exception with browser autocompletion (#651)
Browse files Browse the repository at this point in the history
I got an exception with "Google smart lock" in chrome. In single page application, if there is hidden login page where chrome automatically fills user's data. Then keyboard is shown because of autocompletion and we get an exception in $keyboard.caret() function "Cannot read length of null".

With this changes keyboard is still opened but at least there is no exception.
  • Loading branch information
vkurlyan authored and Mottie committed Feb 12, 2018
1 parent 1db48e9 commit e4f9dd3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion js/jquery.keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -3088,7 +3088,7 @@ http://www.opensource.org/licenses/mit-license.php
};

$keyboard.caret = function($el, param1, param2) {
if (!$el.length || $el.is(':hidden') || $el.css('visibility') === 'hidden') {
if (!$el || !$el.length || $el.is(':hidden') || $el.css('visibility') === 'hidden') {
return {};
}
var start, end, txt, pos,
Expand Down

0 comments on commit e4f9dd3

Please sign in to comment.