mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
MDL-45239 editor_atto: On Android do not restore focus in the callbackWrapper
It seems that Android automatically focuses the cursor in the last position when the content editable region is programatically re-focused. Whilst this does not cause an issue on it's own, when combined with the behaviour of the dictionary auto-completion to restore focus on the start of the word when a word has not yet been finished, this was causing us to change focus when pressing buttons.
This commit is contained in:
parent
37d39fe348
commit
2c549f7802
@ -1024,7 +1024,7 @@ EditorSelection.prototype = {
|
||||
}
|
||||
|
||||
// We can't be active if the editor doesn't have focus at the moment.
|
||||
if (!document.activeElement || document.activeElement !== this.editor) {
|
||||
if (!document.activeElement || Y.one(document.activeElement) !== this.editor) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -1019,7 +1019,7 @@ EditorSelection.prototype = {
|
||||
}
|
||||
|
||||
// We can't be active if the editor doesn't have focus at the moment.
|
||||
if (!document.activeElement || document.activeElement !== this.editor) {
|
||||
if (!document.activeElement || Y.one(document.activeElement) !== this.editor) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -751,7 +751,11 @@ EditorPluginButtons.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.get('host').isActive()) {
|
||||
if (!(YUI.Env.UA.android || this.get('host').isActive())) {
|
||||
// We must not focus for Android here, even if the editor is not active because the keyboard auto-completion
|
||||
// changes the cursor position.
|
||||
// If we save that change, then when we restore the change later we get put in the wrong place.
|
||||
// Android is fine to save the selection without the editor being in focus.
|
||||
this.get('host').focus();
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -749,7 +749,11 @@ EditorPluginButtons.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.get('host').isActive()) {
|
||||
if (!(YUI.Env.UA.android || this.get('host').isActive())) {
|
||||
// We must not focus for Android here, even if the editor is not active because the keyboard auto-completion
|
||||
// changes the cursor position.
|
||||
// If we save that change, then when we restore the change later we get put in the wrong place.
|
||||
// Android is fine to save the selection without the editor being in focus.
|
||||
this.get('host').focus();
|
||||
}
|
||||
|
||||
|
@ -602,7 +602,11 @@ EditorPluginButtons.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.get('host').isActive()) {
|
||||
if (!(YUI.Env.UA.android || this.get('host').isActive())) {
|
||||
// We must not focus for Android here, even if the editor is not active because the keyboard auto-completion
|
||||
// changes the cursor position.
|
||||
// If we save that change, then when we restore the change later we get put in the wrong place.
|
||||
// Android is fine to save the selection without the editor being in focus.
|
||||
this.get('host').focus();
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ EditorSelection.prototype = {
|
||||
}
|
||||
|
||||
// We can't be active if the editor doesn't have focus at the moment.
|
||||
if (!document.activeElement || document.activeElement !== this.editor) {
|
||||
if (!document.activeElement || Y.one(document.activeElement) !== this.editor) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user