wp/wp-includes/js/wp-ajax-response.js
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
--- a/wp/wp-includes/js/wp-ajax-response.js	Thu Sep 29 08:06:27 2022 +0200
+++ b/wp/wp-includes/js/wp-ajax-response.js	Fri Sep 05 18:40:08 2025 +0200
@@ -53,19 +53,27 @@
 				parsed.responses.push( response );
 			} );
 			if ( err.length ) {
-				re.html( '<div class="error">' + err + '</div>' );
+				re.html( '<div class="notice notice-error" role="alert">' + 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" role="alert"><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" role="alert"><p>' + x + '</p></div>' );
+		}
+		x = parseInt( x, 10 );
+		if ( -1 === x ) {
+			wp.a11y.speak( wpAjax.noPerm );
+			return ! re.html( '<div class="notice notice-error" role="alert"><p>' + wpAjax.noPerm + '</p></div>' );
+		} else if ( 0 === x ) {
+			wp.a11y.speak( wpAjax.broken );
+			return ! re.html( '<div class="notice notice-error" role="alert"><p>' + wpAjax.broken  + '</p></div>' );
+		}
 		return true;
 	},
 	invalidateForm: function ( selector ) {