Catrope has uploaded a new change for review.

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


Change subject: Make cursoring over a FocusableNode work again
......................................................................

Make cursoring over a FocusableNode work again

When you cursor onto a FocusableNode, it's selected, and we focus the
paste target as part of our hack to make copying FocusableNodes work
in Firefox. But then when you press the arrow key again, that event
isn't picked up by anything, and you can't move the cursor off the
FocusableNode using the keyboard.

Fixed by attaching the EventSequencer to the paste target when it
receives focus.

Bug: 54443
Change-Id: I7bddcfa9fa6f38908e315c97623bd27133daa98d
---
M modules/ve/ce/ve.ce.Surface.js
1 file changed, 21 insertions(+), 1 deletion(-)


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

diff --git a/modules/ve/ce/ve.ce.Surface.js b/modules/ve/ce/ve.ce.Surface.js
index e85000a..5200a37 100644
--- a/modules/ve/ce/ve.ce.Surface.js
+++ b/modules/ve/ce/ve.ce.Surface.js
@@ -70,7 +70,9 @@
        } );
        this.$pasteTarget.on( {
                'cut': ve.bind( this.onCut, this ),
-               'copy': ve.bind( this.onCopy, this )
+               'copy': ve.bind( this.onCopy, this ),
+               'focus': ve.bind( this.pasteTargetOnFocus, this ),
+               'blur': ve.bind( this.pasteTargetOnBlur, this )
        } );
        $documentNode.on( $.browser.msie ? 'beforepaste' : 'paste', ve.bind( 
this.onPaste, this ) );
        $documentNode.on( 'focus', 'a', function () {
@@ -344,6 +346,24 @@
 };
 
 /**
+ * Handle focus events on the paste target.
+ * @param {jQuery.Event} e Focus event
+ */
+ve.ce.Surface.prototype.pasteTargetOnFocus = function () {
+       // The paste target is focused when a FocusableNode is selected. Attach 
the EventSequencer
+       // to the paste target so we don't miss e.g. arrow key events.
+       this.eventSequencer.attach( this.$pasteTarget );
+};
+
+/**
+ * Handle blur events on the paste target.
+ * @param {jQuery.Event} e Blur event
+ */
+ve.ce.Surface.prototype.pasteTargetOnBlur = function () {
+       this.eventSequencer.detach();
+};
+
+/**
  * Handle document mouse down events.
  *
  * @method

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7bddcfa9fa6f38908e315c97623bd27133daa98d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>

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

Reply via email to