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

This commit is contained in:
jenkins-bot 2016-06-30 21:35:21 +00:00 committed by Gerrit Code Review
commit 4a7f208e53

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 );