DesktopArticleTarget: view click handler should only run for active target

Not checking this results in handlers blocking click actions for "read" after
the teardown of the target.

Bug: T197445
Change-Id: I3a962c66c82a0e48ca54bf2f0b822a9a005da54c
This commit is contained in:
David Lynch 2018-06-18 10:46:33 -05:00
parent ad339f61aa
commit 814e26f1e9

View file

@ -931,7 +931,7 @@ ve.init.mw.DesktopArticleTarget.prototype.onDocumentKeyDown = function ( e ) {
* @param {jQuery.Event} e Mouse click event
*/
ve.init.mw.DesktopArticleTarget.prototype.onViewTabClick = function ( e ) {
if ( !ve.isUnmodifiedLeftClick( e ) ) {
if ( ( !this.active && !this.activating ) || !ve.isUnmodifiedLeftClick( e ) ) {
return;
}
this.tryTeardown( false, 'navigate-read' );
@ -1104,11 +1104,11 @@ ve.init.mw.DesktopArticleTarget.prototype.setupSkinTabs = function () {
}
// Allow instant switching back to view mode, without refresh
$( '#ca-view a, #ca-nstab-' + namespaceKey + ' a' )
.on( 'click', this.onViewTabClick.bind( this ) );
.on( 'click.ve-target', this.onViewTabClick.bind( this ) );
}
if ( !mw.libs.ve.isSingleEditTab ) {
$( '#ca-viewsource, #ca-edit' ).on( 'click', function ( e ) {
$( '#ca-viewsource, #ca-edit' ).on( 'click.ve-target', function ( e ) {
if ( !target.active || !ve.isUnmodifiedLeftClick( e ) ) {
return;
}