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 this.$ (which is the parent
of $documentNode and $pasteTarget) and listening for focus/blur on
both $documentNode and $pasteTarget.

Bug: 54443
Change-Id: I7bddcfa9fa6f38908e315c97623bd27133daa98d
This commit is contained in:
Roan Kattouw 2013-09-30 18:10:46 -07:00
parent 7052472c2b
commit 5592ea2602

View file

@ -70,7 +70,10 @@ ve.ce.Surface = function VeCeSurface( model, surface, options ) {
} ); } );
this.$pasteTarget.on( { this.$pasteTarget.on( {
'cut': ve.bind( this.onCut, this ), 'cut': ve.bind( this.onCut, this ),
'copy': ve.bind( this.onCopy, this ) 'copy': ve.bind( this.onCopy, this ),
// $pasteTarget is focused when selecting a FocusableNode
'focus': ve.bind( this.documentOnFocus, this ),
'blur': ve.bind( this.documentOnBlur, this )
} ); } );
$documentNode.on( $.browser.msie ? 'beforepaste' : 'paste', ve.bind( this.onPaste, this ) ); $documentNode.on( $.browser.msie ? 'beforepaste' : 'paste', ve.bind( this.onPaste, this ) );
$documentNode.on( 'focus', 'a', function () { $documentNode.on( 'focus', 'a', function () {
@ -326,7 +329,7 @@ ve.ce.Surface.prototype.focus = function () {
* @param {jQuery.Event} e Focus event * @param {jQuery.Event} e Focus event
*/ */
ve.ce.Surface.prototype.documentOnFocus = function () { ve.ce.Surface.prototype.documentOnFocus = function () {
this.eventSequencer.attach( this.$document ); this.eventSequencer.attach( this.$ );
this.surfaceObserver.startTimerLoop(); this.surfaceObserver.startTimerLoop();
}; };