Make WordPress Core

Changeset 53911


Ignore:
Timestamp:
08/19/2022 08:58:34 PM (2 years ago)
Author:
joedolson
Message:

Permalinks: Fix aria-live text when removing custom structure.

Change the notification announced when a custom structure is removed. Previously, the notification incorrectly indicated that the structure was added for both actions. This changes the notification to correctly announce removals when structures are removed.

Props joedolson, kebbet, SergeyBiryukov.
Fixes #56230.

Location:
trunk/src
Files:
2 edited

Legend:

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

    r52591 r53911  
    752752        selectionEnd            = $permalinkStructure[ 0 ].selectionEnd,
    753753        textToAppend            = $( this ).text().trim(),
    754         textToAnnounce          = $( this ).attr( 'data-added' ),
     754        textToAnnounce,
    755755        newSelectionStart;
     756
     757    if ( $( this ).hasClass( 'active' ) ) {
     758        textToAnnounce = $( this ).attr( 'data-removed' );
     759    } else {
     760        textToAnnounce = $( this ).attr( 'data-added' );
     761    }
    756762
    757763    // Remove structure tag if already part of the structure.
  • trunk/src/wp-admin/options-permalink.php

    r53714 r53911  
    310310/* translators: %s: Permalink structure tag. */
    311311$tag_added = __( '%s added to permalink structure' );
    312 
     312/* translators: %s: Permalink structure tag. */
     313$tag_removed = __( '%s removed from permalink structure' );
    313314/* translators: %s: Permalink structure tag. */
    314315$tag_already_used = __( '%s (already used in permalink structure)' );
     
    379380                                        aria-label="<?php echo esc_attr( sprintf( $explanation, $tag ) ); ?>"
    380381                                        data-added="<?php echo esc_attr( sprintf( $tag_added, $tag ) ); ?>"
     382                                        data-removed="<?php echo esc_attr( sprintf( $tag_removed, $tag ) ); ?>"
    381383                                        data-used="<?php echo esc_attr( sprintf( $tag_already_used, $tag ) ); ?>">
    382384                                        <?php echo '%' . $tag . '%'; ?>
Note: See TracChangeset for help on using the changeset viewer.