Skip to content

Commit

Permalink
fix: Removed focussing after timeout in text input (#4716)
Browse files Browse the repository at this point in the history
* fix: Removed focussing after timeout in text input

* Added timeout in mouse handler

* Added new line
  • Loading branch information
andrewnester committed May 30, 2022
1 parent 8f49d65 commit f8ea48f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
8 changes: 0 additions & 8 deletions lib/ace/editor.js
Expand Up @@ -692,14 +692,6 @@ Editor.$uid = 0;
* Brings the current `textInput` into focus.
**/
this.focus = function() {
// focusing after timeout is not needed now, but some code using ace
// depends on being able to call focus when textarea is not visible,
// so to keep backwards compatibility we keep this until the next major release
var _self = this;
setTimeout(function() {
if (!_self.isFocused())
_self.textInput.focus();
});
this.textInput.focus();
};

Expand Down
4 changes: 4 additions & 0 deletions lib/ace/mouse/mouse_handler.js
Expand Up @@ -56,6 +56,10 @@ var MouseHandler = function(editor) {
if (windowBlurred)
window.focus();
editor.focus();
// Without this editor is blurred after double click
setTimeout(function () {
if (!editor.isFocused()) editor.focus();
});
};

var mouseTarget = editor.renderer.getMouseEventTarget();
Expand Down

0 comments on commit f8ea48f

Please sign in to comment.