diff --git a/modules/ve-mw/ui/pages/ve.ui.MWSettingsPage.js b/modules/ve-mw/ui/pages/ve.ui.MWSettingsPage.js index 3ffaa927cc..2666b9a31f 100644 --- a/modules/ve-mw/ui/pages/ve.ui.MWSettingsPage.js +++ b/modules/ve-mw/ui/pages/ve.ui.MWSettingsPage.js @@ -195,10 +195,24 @@ ve.ui.MWSettingsPage.prototype.onTableOfContentsFieldChange = function () { * @param {boolean} value Whether a redirect is to be set for this page */ ve.ui.MWSettingsPage.prototype.onEnableRedirectChange = function ( value ) { + var page = this; this.redirectTargetInput.setDisabled( !value ); this.enableStaticRedirectInput.setDisabled( !value ); if ( value ) { - this.redirectTargetInput.focus(); + /* + * HACK: When editing a page which has a redirect, the meta dialog + * automatically opens with the settings page's redirect field focused. + * When this happens, we don't want the lookup dropdown to appear until + * the user actually does something. + * Using setTimeout because we need to defer this until after the + * dialog has opened - otherwise its internal lookupDisabled logic will + * fail to have any effect during the actual focusing and calling of + * OO.ui.LookupElement#onLookupInputFocus/OO.ui.LookupElement#populateLookupMenu. + * https://phabricator.wikimedia.org/T137309 + */ + setTimeout( function () { + page.redirectTargetInput.focus(); + } ); } else { this.redirectTargetInput.setValue( '' ); this.enableStaticRedirectInput.setSelected( false );