💦 FULL SET: Changeset/ - HD Photos!

Changeset 52170


Ignore:
Timestamp:
11/15/2021 10:23:01 PM (4 years ago)
Author:
joedolson
Message:

Taxonomy: Display update notices when adding terms.

Display notice and announce to screen readers when a new term is added.

Props manishamakhija, birgire, dilipbheda, afercia, hellofromTonya.
Fixes #42937.

Location:
trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/lib/ajax-response.js

    r52169 r52170  
    1919    },
    2020    parseAjaxResponse: function( x, r, e ) { // 1 = good, 0 = strange (bad data?), -1 = you lack permission.
    21         var parsed = {}, re = jQuery('#' + r).empty(), err = '';
     21        var parsed = {}, re = jQuery('#' + r).empty(), err = '', successmsg = '';
    2222
    2323        if ( x && typeof x === 'object' && x.getElementsByTagName('wp_ajax') ) {
     
    2828                response = { action: th.attr('action'), what: child.get(0).nodeName, id: child.attr('id'), oldId: child.attr('old_id'), position: child.attr('position') };
    2929                response.data = jQuery( 'response_data', child ).text();
     30                successmsg += response.data;
    3031                response.supplemental = {};
    3132                if ( !jQuery( 'supplemental', child ).children().each( function() {
     
    4748                parsed.responses.push( response );
    4849            } );
    49             if ( err.length ) { re.html( '<div class="error">' + err + '</div>' ); }
     50            if ( err.length ) {
     51                re.html( '<div class="error">' + err + '</div>' );
     52                wp.a11y.speak( err );
     53            } else {
     54                re.html( '<div class="updated notice is-dismissible"><p>' + successmsg + '</p></div>');
     55                jQuery(document).trigger( 'wp-updates-notice-added' );
     56                wp.a11y.speak( successmsg );
     57            }
    5058            return parsed;
    5159        }
  • trunk/src/wp-admin/includes/ajax-actions.php