From e1946cc212febd0fe546f5d6c8307f79a4ad0a9f Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Tue, 2 May 2017 12:35:27 -0400 Subject: [PATCH] mw.special.apisandbox: Don't pass $label to OO.ui.FieldLayout They removed that functionality. Instead, access the FieldLayout's $label property to attach the click event handler we need. It's not documented (I think), but seems stable. Bug: T164149 Change-Id: I30e7ad51dc1a484203138919c19a55f77552f330 --- .../mediawiki.special.apisandbox.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/resources/src/mediawiki.special/mediawiki.special.apisandbox.js b/resources/src/mediawiki.special/mediawiki.special.apisandbox.js index 7cb67b0084..3cfce3f695 100644 --- a/resources/src/mediawiki.special/mediawiki.special.apisandbox.js +++ b/resources/src/mediawiki.special/mediawiki.special.apisandbox.js @@ -1357,7 +1357,7 @@ Util.fetchModuleInfo( this.apiModule ) .done( function ( pi ) { - var prefix, i, j, descriptionContainer, widget, $widgetLabel, widgetField, helpField, tmp, flag, count, + var prefix, i, j, descriptionContainer, widget, widgetField, helpField, tmp, flag, count, items = [], deprecatedItems = [], buttons = [], @@ -1573,20 +1573,18 @@ } ); - $widgetLabel = $( '' ); widgetField = new OO.ui.FieldLayout( widget, { align: 'left', classes: [ 'mw-apisandbox-widget-field' ], - label: prefix + pi.parameters[ i ].name, - $label: $widgetLabel + label: prefix + pi.parameters[ i ].name } ); - // FieldLayout only does click for InputElement - // widgets. So supply our own click handler. - $widgetLabel.on( 'click', widgetLabelOnClick.bind( widgetField ) ); + // We need our own click handler on the widget label to + // turn off the disablement. + widgetField.$label.on( 'click', widgetLabelOnClick.bind( widgetField ) ); // Don't grey out the label when the field is disabled, // it makes it too hard to read and our "disabled" -- 2.20.1