From b11b144ad6b268c0029cb90f6f859a12dd3e777f Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Thu, 24 Aug 2017 15:38:11 +0100 Subject: [PATCH] Don't focus media dialog until ready process Bug: T174027 Change-Id: I070b5538e12c8a165a714ac6c3fd172f0ed179d4 --- modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js index 36ca56d0ab..0926b8216a 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js @@ -1126,8 +1126,6 @@ ve.ui.MWMediaDialog.prototype.getSetupProcess = function ( data ) { return this.mediaUploadBooklet.initialize().then( function () { dialog.actions.setAbilities( { upload: false, save: false, insert: false, apply: false } ); - dialog.switchPanels( dialog.selectedNode ? 'edit' : 'search' ); - if ( data.file ) { dialog.searchTabs.setTabPanel( 'upload' ); dialog.mediaUploadBooklet.setFile( data.file ); @@ -1298,13 +1296,8 @@ ve.ui.MWMediaDialog.prototype.resetCaption = function () { ve.ui.MWMediaDialog.prototype.getReadyProcess = function ( data ) { return ve.ui.MWMediaDialog.super.prototype.getReadyProcess.call( this, data ) .next( function () { - if ( this.currentPanel === 'search' ) { - // Focus the search input - this.search.getQuery().focus().select(); - } else { - // Focus the caption surface - this.captionTarget.focus(); - } + // #switchPanels triggers field focus, so do this in the ready process + this.switchPanels( this.selectedNode ? 'edit' : 'search' ); // Revalidate size this.sizeWidget.validateDimensions(); }, this );