From 134a35ad1aff294f290be023ae27d6bb379b236e Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Fri, 10 Jun 2016 17:28:19 +0100 Subject: [PATCH] Hack to not show menu immediately upon meta dialog opening for redirect change Bug: T137309 Change-Id: Iba22b909e8208d2a314de8313db9d910410c9a1d --- modules/ve-mw/ui/pages/ve.ui.MWSettingsPage.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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 );