Matmarex has uploaded a new change for review. https://gerrit.wikimedia.org/r/61358
Change subject: Don't bind 'blur' and 'focus' on the document node in Opera ...................................................................... Don't bind 'blur' and 'focus' on the document node in Opera Opera triggers 'blur' when clicking on any <a> link, then "forgets" to trigger 'focus'. This causes the change polling to stop - SurfaceObserver.prototype.stop is called without a subsequent call to SurfaceObserver.prototype.start). Let's just not bind these events, as the worst this can cause is worse performance (unnecessary polling when the window is not active). The only way I've found to restore focus (and resume polling) is to press 'Esc' (this fires another 'blur' event), then click inside the document node (this finally fires 'focus'). Bug: 47793 Change-Id: Iaaa2a7993f3561dc663a064468c396ebfe951ce7 --- M modules/ve/ce/ve.ce.Surface.js 1 file changed, 9 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/58/61358/1 diff --git a/modules/ve/ce/ve.ce.Surface.js b/modules/ve/ce/ve.ce.Surface.js index 125a961..c9df06e 100644 --- a/modules/ve/ce/ve.ce.Surface.js +++ b/modules/ve/ce/ve.ce.Surface.js @@ -47,10 +47,15 @@ this.model.addListenerMethods( this, { 'change': 'onChange', 'lock': 'onLock', 'unlock': 'onUnlock' } ); - this.documentView.getDocumentNode().$.on( { - 'focus': ve.bind( this.documentOnFocus, this ), - 'blur': ve.bind( this.documentOnBlur, this ) - } ); + // Opera triggers 'blur' when clicking on any <a> link, then "forgets" to trigger 'focus'. + // Let's just not bind these events, as the worst this can cause is worse performance + // (unnecessary polling when the window is not active). + if ( $.client.test( { ltr: { opera: false }, rtl: { opera: false } } ) ) { + this.documentView.getDocumentNode().$.on( { + 'focus': ve.bind( this.documentOnFocus, this ), + 'blur': ve.bind( this.documentOnBlur, this ) + } ); + } this.$.on( { 'cut': ve.bind( this.onCut, this ), 'copy': ve.bind( this.onCopy, this ), -- To view, visit https://gerrit.wikimedia.org/r/61358 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iaaa2a7993f3561dc663a064468c396ebfe951ce7 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