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

Reply via email to