[MediaWiki-commits] [Gerrit] ve.ce.Surface: Prevent focus loss on the document node in Opera - change (mediawiki...VisualEditor)

2013-07-29 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: ve.ce.Surface: Prevent focus loss on the document node in Opera
..


ve.ce.Surface: Prevent focus loss on the document node in Opera

Opera triggers 'blur' on the document node when clicking on any a
link and never trigger 'focus' until after the user blurs the document
node *again* (by clicking outside of it or pressing 'Esc').

This causes the change polling to stop (SurfaceObserver#stop is called
without a subsequent call to SurfaceObserver#start).

To avoid this let's bind a delegated 'focus' event on all a links
inside the document and refocus it whenever that happens.

Bug: 47793
Change-Id: I7962f59bd02e075f91e42e6514b390c0d0feb3ab
---
M modules/ve/ce/ve.ce.Surface.js
1 file changed, 9 insertions(+), 1 deletion(-)

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



diff --git a/modules/ve/ce/ve.ce.Surface.js b/modules/ve/ce/ve.ce.Surface.js
index 68519f3..5f2f71c 100644
--- a/modules/ve/ce/ve.ce.Surface.js
+++ b/modules/ve/ce/ve.ce.Surface.js
@@ -51,10 +51,18 @@
this, { 'contentChange': 'onContentChange', 'selectionChange': 
'onSelectionChange' }
);
this.model.connect( this, { 'change': 'onChange', 'lock': 'onLock', 
'unlock': 'onUnlock' } );
-   this.documentView.getDocumentNode().$.on( {
+
+   var $documentNode = this.documentView.getDocumentNode().$;
+   $documentNode.on( {
'focus': ve.bind( this.documentOnFocus, this ),
'blur': ve.bind( this.documentOnBlur, this )
} );
+   $documentNode.on( 'focus', 'a', function () {
+   // Opera triggers 'blur' on document node before any link is
+   // focused and we don't want that
+   $documentNode[0].focus();
+   } );
+
this.$.on( {
'cut': ve.bind( this.onCut, this ),
'copy': ve.bind( this.onCopy, this ),

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I7962f59bd02e075f91e42e6514b390c0d0feb3ab
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Matmarex matma@gmail.com
Gerrit-Reviewer: Catrope roan.katt...@gmail.com
Gerrit-Reviewer: Inez i...@wikia-inc.com
Gerrit-Reviewer: Krinkle krinklem...@gmail.com
Gerrit-Reviewer: Matmarex matma@gmail.com
Gerrit-Reviewer: Trevor Parscal tpars...@wikimedia.org
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] ve.ce.Surface: Prevent focus loss on the document node in Opera - change (mediawiki...VisualEditor)

2013-06-29 Thread Matmarex (Code Review)
Matmarex has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/71249


Change subject: ve.ce.Surface: Prevent focus loss on the document node in Opera
..

ve.ce.Surface: Prevent focus loss on the document node in Opera

Opera triggers 'blur' on the document node when clicking on any a
link and never trigger 'focus' until after the user blurs the document
node *again* (by clicking outside of it or pressing 'Esc').

This causes the change polling to stop (SurfaceObserver#stop is called
without a subsequent call to SurfaceObserver#start).

To avoid this let's bind a delegated 'focus' event on all a links
inside the document and refocus it whenever that happens.

Bug: 47793
Change-Id: I7962f59bd02e075f91e42e6514b390c0d0feb3ab
---
M modules/ve/ce/ve.ce.Surface.js
1 file changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/49/71249/1

diff --git a/modules/ve/ce/ve.ce.Surface.js b/modules/ve/ce/ve.ce.Surface.js
index 6b7a218..b58a643 100644
--- a/modules/ve/ce/ve.ce.Surface.js
+++ b/modules/ve/ce/ve.ce.Surface.js
@@ -55,6 +55,12 @@
'focus': ve.bind( this.documentOnFocus, this ),
'blur': ve.bind( this.documentOnBlur, this )
} );
+   this.documentView.getDocumentNode().$.on( 'focus', 'a', function () {
+   // Opera triggers 'blur' on document node before any link is
+   // focused and we don't want that
+   $( this ).closest( '.ve-ce-documentNode' ).focus();
+   } );
+
this.$.on( {
'cut': ve.bind( this.onCut, this ),
'copy': ve.bind( this.onCopy, this ),

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7962f59bd02e075f91e42e6514b390c0d0feb3ab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Matmarex matma@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits