* Submit button handler
*/
sendRequest: function () {
- var page, subpages, i, query, $result,
+ var page, subpages, i, query, $result, $focus,
progress, $progressText, progressLoading,
deferreds = [],
params = {},
displayParams = {},
checkPages = [ pages.main ];
+ // Blur any focused widget before submit, because
+ // OO.ui.ButtonWidget doesn't take focus itself (T128054)
+ $focus = $( '#mw-apisandbox-ui' ).find( document.activeElement );
+ if ( $focus.length ) {
+ $focus[ 0 ].blur();
+ }
+
suppressErrors = false;
while ( checkPages.length ) {
return xhr;
}
} )
+ .then( null, function ( code, data, result, jqXHR ) {
+ if ( code !== 'http' ) {
+ // Not really an error, work around mw.Api thinking it is.
+ return $.Deferred()
+ .resolve( result, jqXHR )
+ .promise();
+ }
+ return this;
+ } )
.fail( function ( code, data ) {
var details = 'HTTP error: ' + data.exception;
$result.empty()