diff --git a/plugins/wporg-5ftf/assets/js/frontend.js b/plugins/wporg-5ftf/assets/js/frontend.js index 5cef190..b8f4054 100644 --- a/plugins/wporg-5ftf/assets/js/frontend.js +++ b/plugins/wporg-5ftf/assets/js/frontend.js @@ -93,15 +93,19 @@ jQuery( document ).ready( function( $ ) { }, success( response ) { if ( response.message ) { - const $message = $( '
' ) - .addClass( 'notice notice-alt' ) - .addClass( response.success ? 'notice-success' : 'notice-error' ) - .append( $( '

' ).html( response.message ) ); - - $( event.target.querySelector( '.message' ) ).html( $message ); + // Say the message for screen reader users. + wp.a11y.speak( response.message ); if ( response.success ) { - $( event.target.querySelector( 'input[type="submit"]' ) ).remove(); + closeModal(); + $( button ).after( $( '

' ).html( '' + response.message + '' ) ); + } else { + const $message = $( '

' ) + .addClass( 'notice notice-alt' ) + .addClass( response.success ? 'notice-success' : 'notice-error' ) + .append( $( '

' ).html( response.message ) ); + + $( event.target.querySelector( '.message' ) ).html( $message ); } } }, diff --git a/plugins/wporg-5ftf/includes/pledge.php b/plugins/wporg-5ftf/includes/pledge.php index d54cb34..a54af34 100755 --- a/plugins/wporg-5ftf/includes/pledge.php +++ b/plugins/wporg-5ftf/includes/pledge.php @@ -270,7 +270,7 @@ function enqueue_assets() { if ( CPT_ID === get_post_type() ) { $ver = filemtime( FiveForTheFuture\PATH . '/assets/js/frontend.js' ); - wp_enqueue_script( '5ftf-frontend', plugins_url( 'assets/js/frontend.js', __DIR__ ), [ 'jquery', 'wp-util', 'wicg-inert' ], $ver, true ); + wp_enqueue_script( '5ftf-frontend', plugins_url( 'assets/js/frontend.js', __DIR__ ), [ 'jquery', 'wp-a11y', 'wp-util', 'wicg-inert' ], $ver, true ); $script_data = [ 'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ), // The global ajaxurl is not set on the frontend. diff --git a/plugins/wporg-5ftf/views/modal-request-manage-link.php b/plugins/wporg-5ftf/views/modal-request-manage-link.php index e06df4d..ace5eab 100644 --- a/plugins/wporg-5ftf/views/modal-request-manage-link.php +++ b/plugins/wporg-5ftf/views/modal-request-manage-link.php @@ -31,7 +31,7 @@ defined( 'WPINC' ) || die(); value="" /> -

+