Hack to not show menu immediately upon meta dialog opening for redirect change

Bug: T137309
Change-Id: Iba22b909e8208d2a314de8313db9d910410c9a1d
This commit is contained in:
Alex Monk 2016-06-10 17:28:19 +01:00
parent e91fd07a5c
commit 134a35ad1a

View file

@ -195,10 +195,24 @@ ve.ui.MWSettingsPage.prototype.onTableOfContentsFieldChange = function () {
* @param {boolean} value Whether a redirect is to be set for this page * @param {boolean} value Whether a redirect is to be set for this page
*/ */
ve.ui.MWSettingsPage.prototype.onEnableRedirectChange = function ( value ) { ve.ui.MWSettingsPage.prototype.onEnableRedirectChange = function ( value ) {
var page = this;
this.redirectTargetInput.setDisabled( !value ); this.redirectTargetInput.setDisabled( !value );
this.enableStaticRedirectInput.setDisabled( !value ); this.enableStaticRedirectInput.setDisabled( !value );
if ( 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 { } else {
this.redirectTargetInput.setValue( '' ); this.redirectTargetInput.setValue( '' );
this.enableStaticRedirectInput.setSelected( false ); this.enableStaticRedirectInput.setSelected( false );