Skip to content

Commit

Permalink
Fix for Issue nosir#385 (nosir#387)
Browse files Browse the repository at this point in the history
*  On branch master
 Your branch is up to date with 'origin/master'.

 Changes to be committed:
	modified:   src/utils/Util.js

 Issue nosir#385 for cursor jumping to the end when used in shadow DOM fixed

* doc.activeElement to activeElement refactored

*  Rework for failed cursor jumping issue fixed on branch master for PR
 Your branch is up to date with 'origin/master'.

 Changes to be committed:
	modified:   src/utils/Util.js
  • Loading branch information
Leon Jäkel authored and nosir committed Aug 15, 2018
1 parent fb74710 commit 8ed113e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/utils/Util.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ var Util = {
},

setSelection: function (element, position, doc) {
if (element !== doc.activeElement) {
if (element !== this.getActiveElement(doc)) {
return;
}

Expand All @@ -194,6 +194,14 @@ var Util = {
}
}
},

getActiveElement: function(parent) {
var activeElement = parent.activeElement;
if (activeElement && activeElement.shadowRoot) {
return this.getActiveElement(activeElement.shadowRoot);
}
return activeElement;
},

isAndroid: function () {
return navigator && /android/i.test(navigator.userAgent);
Expand Down

0 comments on commit 8ed113e

Please sign in to comment.