Make WordPress Core

Changeset 45683


Ignore:
Timestamp:
07/26/2019 05:45:21 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Accessibility: Taxonomy: When a new category or tag is being added, show a spinner and noop the button to avoid multiple requests.

Props andg, afercia, guddu1315, SergeyBiryukov.
Fixes #47607.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/admin/tags.js

    r43347 r45683  
    1111
    1212jQuery(document).ready(function($) {
     13
     14    var addingTerm = false;
    1315
    1416    /**
     
    103105            return false;
    104106
     107        if ( addingTerm ) {
     108            // If we're adding a term, noop the button to avoid duplicate requests.
     109            return false;
     110        }
     111
     112        addingTerm = true;
     113        form.find( '.submit .spinner' ).addClass( 'is-active' );
     114
    105115        /**
    106116         * Does a request to the server to add a new term to the database
     
    112122        $.post(ajaxurl, $('#addtag').serialize(), function(r){
    113123            var res, parent, term, indent, i;
     124
     125            addingTerm = false;
     126            form.find( '.submit .spinner' ).removeClass( 'is-active' );
    114127
    115128            $('#ajax-response').empty();
  • trunk/src/wp-admin/css/edit.css

    r45483 r45683  
    11621162.ac_match {
    11631163    text-decoration: underline;
     1164}
     1165
     1166#addtag .spinner {
     1167    float: none;
     1168    vertical-align: top;
    11641169}
    11651170
  • trunk/src/wp-admin/edit-tags.php

    r45674 r45683  
    516516     */
    517517    do_action( "{$taxonomy}_add_form_fields", $taxonomy );
    518 
    519     submit_button( $tax->labels->add_new_item );
    520 
     518    ?>
     519    <p class="submit">
     520        <?php submit_button( $tax->labels->add_new_item, 'primary', 'submit', false ); ?>
     521        <span class="spinner"></span>
     522    </p>
     523    <?php
    521524    if ( 'category' == $taxonomy ) {
    522525        /**
Note: See TracChangeset for help on using the changeset viewer.