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:
parent
a6e15fb47a
commit
6f1f84aa62
1 changed files with 4 additions and 2 deletions
|
@ -1428,8 +1428,10 @@ weechat.directive('inputBar', function() {
|
||||||
$scope.command = nickComp.text;
|
$scope.command = nickComp.text;
|
||||||
|
|
||||||
// update current caret position
|
// update current caret position
|
||||||
|
setTimeout(function() {
|
||||||
inputNode.focus();
|
inputNode.focus();
|
||||||
inputNode.setSelectionRange(nickComp.caretPos, nickComp.caretPos);
|
inputNode.setSelectionRange(nickComp.caretPos, nickComp.caretPos);
|
||||||
|
}, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue