Catrope has uploaded a new change for review. https://gerrit.wikimedia.org/r/189160
Change subject: MWMediaDialog: Focus the right thing on ready, depending on the panel shown ...................................................................... MWMediaDialog: Focus the right thing on ready, depending on the panel shown The ready handler unconditionally focused the surface, even if a different panel was shown. Prior to aa9eb9545 this didn't actually break the search mode, because the search input was focused after the image repo information came back, which usually happened after ready. However, aa9eb9545 instead focused the search input from the setup process, which is too early. Also introduce this.currentPanel as a way to track which panel is currently visible. Bug: T88881 Change-Id: I0189fbeed73ee9103e45fec4a1bc8d4ee1b6ed40 --- M modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js 1 file changed, 8 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/60/189160/1 diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js index 21f9031..d5f1ada 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js @@ -1062,7 +1062,6 @@ this.selectedImageInfo = null; if ( !stopSearchRequery ) { this.search.query.setValue( dialog.pageTitle ); - this.search.query.focus().select(); } // Set the edit panel @@ -1084,6 +1083,7 @@ this.panels.setItem( this.mediaImageInfoPanel ); break; } + this.currentPanel = panel || 'imageinfo'; }; /** @@ -1247,8 +1247,13 @@ ve.ui.MWMediaDialog.prototype.getReadyProcess = function ( data ) { return ve.ui.MWMediaDialog.super.prototype.getReadyProcess.call( this, data ) .next( function () { - // Focus the caption surface - this.captionSurface.focus(); + if ( this.currentPanel === 'search' ) { + // Focus the search input + this.search.query.focus().select(); + } else { + // Focus the caption surface + this.captionSurface.focus(); + } // Revalidate size this.sizeWidget.validateDimensions(); }, this ); -- To view, visit https://gerrit.wikimedia.org/r/189160 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0189fbeed73ee9103e45fec4a1bc8d4ee1b6ed40 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Catrope <roan.katt...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits