Skip to content

Commit

Permalink
fix(): regain focus on mouse move
Browse files Browse the repository at this point in the history
backports #8179

fixes #8177 caused by #3759
and fixes #3661 that was the motivation for #3759

This issue was caused because the hiddenTextarea looses focus after mousedown.
So I have added a focus call in mousemove that fixes both issues.
  • Loading branch information
ShaMan123 committed Aug 25, 2022
1 parent 3c5a991 commit e8704f4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/mixins/canvas_events.mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,6 @@
_target && target.fire('mouseout', { e: e });
});
this._hoveredTargets = [];

if (this._iTextInstances) {
this._iTextInstances.forEach(function(obj) {
if (obj.isEditing) {
obj.hiddenTextarea.focus();
}
});
}
},

/**
Expand Down
3 changes: 3 additions & 0 deletions src/mixins/itext_behavior.mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,9 @@
return;
}

// regain focus
document.activeElement !== this.hiddenTextarea && this.hiddenTextarea.focus();

var newSelectionStart = this.getSelectionStartFromPointer(options.e),
currentStart = this.selectionStart,
currentEnd = this.selectionEnd;
Expand Down

0 comments on commit e8704f4

Please sign in to comment.