jenkins-bot has submitted this change and it was merged.

Change subject: Check for selection in ve.ce.Surface#onDocumentFocus
......................................................................


Check for selection in ve.ce.Surface#onDocumentFocus

Instead of checking if focus was caused by a mouse event, check if there
is a selection already.

This seems to work correctly both on desktop and iOS Safari.

Bug: 66697
Change-Id: Ief6c44cb6c5e25ccdff01f632a5f65a8abc4f3ed
---
M src/ce/ve.ce.Surface.js
1 file changed, 3 insertions(+), 6 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/src/ce/ve.ce.Surface.js b/src/ce/ve.ce.Surface.js
index 25b8357..0728fd9 100644
--- a/src/ce/ve.ce.Surface.js
+++ b/src/ce/ve.ce.Surface.js
@@ -438,12 +438,9 @@
  * @fires focus
  */
 ve.ce.Surface.prototype.onDocumentFocus = function () {
-       // this.dragging is set when the mouse is down, but not on focusable
-       // nodes so check this.focusedNode as well
-       if ( !this.dragging && !this.focusedNode ) {
-               // If the document is being focused by a non-mouse user event, 
FF may place
-               // the cursor in a non-content offset (i.e. just after the 
document div), so
-               // find the first content offset instead.
+       if ( !this.getModel().getSelection() ) {
+               // If the document is being focused by a non-mouse/non-touch 
user event,
+               // find the first content offset and place the cursor there.
                this.getModel().selectFirstContentOffset();
        }
        this.eventSequencer.attach( this.$element );

-- 
To view, visit https://gerrit.wikimedia.org/r/155839
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ief6c44cb6c5e25ccdff01f632a5f65a8abc4f3ed
Gerrit-PatchSet: 2
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: JGonera <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Trevor Parscal <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to