mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Administration: Audible messages on AJAX error cases.
Issues appropriate audible messages via `wp.a11y.speak()` when `ajax-response.js` generates an error via `wp_die()`. Props afercia, alexstine. Fixes #54483. git-svn-id: https://develop.svn.wordpress.org/trunk@53709 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -53,19 +53,27 @@ window.wpAjax = jQuery.extend( {
|
||||
parsed.responses.push( response );
|
||||
} );
|
||||
if ( err.length ) {
|
||||
re.html( '<div class="error">' + err + '</div>' );
|
||||
re.html( '<div class="notice notice-error">' + err + '</div>' );
|
||||
wp.a11y.speak( err );
|
||||
} else if ( noticeMessage.length ) {
|
||||
re.html( '<div class="updated notice is-dismissible"><p>' + noticeMessage + '</p></div>');
|
||||
re.html( '<div class="notice notice-success is-dismissible"><p>' + noticeMessage + '</p></div>');
|
||||
jQuery(document).trigger( 'wp-updates-notice-added' );
|
||||
wp.a11y.speak( noticeMessage );
|
||||
}
|
||||
return parsed;
|
||||
}
|
||||
if ( isNaN(x) ) { return !re.html('<div class="error"><p>' + x + '</p></div>'); }
|
||||
x = parseInt(x,10);
|
||||
if ( -1 === x ) { return !re.html('<div class="error"><p>' + wpAjax.noPerm + '</p></div>'); }
|
||||
else if ( 0 === x ) { return !re.html('<div class="error"><p>' + wpAjax.broken + '</p></div>'); }
|
||||
if ( isNaN( x ) ) {
|
||||
wp.a11y.speak( x );
|
||||
return ! re.html( '<div class="notice notice-error"><p>' + x + '</p></div>' );
|
||||
}
|
||||
x = parseInt( x, 10 );
|
||||
if ( -1 === x ) {
|
||||
wp.a11y.speak( wpAjax.noPerm );
|
||||
return ! re.html( '<div class="notice notice-error"><p>' + wpAjax.noPerm + '</p></div>' );
|
||||
} else if ( 0 === x ) {
|
||||
wp.a11y.speak( wpAjax.broken );
|
||||
return ! re.html( '<div class="notice notice-error"><p>' + wpAjax.broken + '</p></div>' );
|
||||
}
|
||||
return true;
|
||||
},
|
||||
invalidateForm: function ( selector ) {
|
||||
|
||||
Reference in New Issue
Block a user