jenkins-bot has submitted this change and it was merged.

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
(cherry picked from commit 3f15c5be5d96992ae80a82fc9aca7d7145f6cd8c)
---
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
1 file changed, 8 insertions(+), 2 deletions(-)

Approvals:
  Alex Monk: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
index 21f9031..0cdb6d0 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
@@ -1084,6 +1084,7 @@
                        this.panels.setItem( this.mediaImageInfoPanel );
                        break;
        }
+       this.currentPanel = panel || 'imageinfo';
 };
 
 /**
@@ -1247,8 +1248,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/189866
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0189fbeed73ee9103e45fec4a1bc8d4ee1b6ed40
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: wmf/1.25wmf16
Gerrit-Owner: Alex Monk <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to