Prevent triggering ng-focus on input during completion

$apply during another $apply is not possible, and .focus() on the input node
triggers the ng-focus on it (which hides the sidebar, if on mobile), so to
prevent the exception from being thrown, move the input node focusing
out of the $apply with a timeout of 0.
This commit is contained in:
Lorenz Hübschle-Schneider 2014-08-24 18:13:24 +01:00
parent a6e15fb47a
commit 6f1f84aa62

View file

@ -1428,8 +1428,10 @@ weechat.directive('inputBar', function() {
$scope.command = nickComp.text;
// update current caret position
setTimeout(function() {
inputNode.focus();
inputNode.setSelectionRange(nickComp.caretPos, nickComp.caretPos);
}, 0);
};