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