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.
Built from https://develop.svn.wordpress.org/trunk@53911


git-svn-id: http://core.svn.wordpress.org/trunk@53470 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
joedolson 2022-08-19 21:00:09 +00:00
parent 594f5ae8c1
commit f5ca26cd24
4 changed files with 12 additions and 4 deletions

View File

@ -751,9 +751,15 @@ $availableStructureTags.on( 'click', function() {
selectionStart = $permalinkStructure[ 0 ].selectionStart,
selectionEnd = $permalinkStructure[ 0 ].selectionEnd,
textToAppend = $( this ).text().trim(),
textToAnnounce = $( this ).attr( 'data-added' ),
textToAnnounce,
newSelectionStart;
if ( $( this ).hasClass( 'active' ) ) {
textToAnnounce = $( this ).attr( 'data-removed' );
} else {
textToAnnounce = $( this ).attr( 'data-added' );
}
// Remove structure tag if already part of the structure.
if ( -1 !== permalinkStructureValue.indexOf( textToAppend ) ) {
permalinkStructureValue = permalinkStructureValue.replace( textToAppend + '/', '' );

File diff suppressed because one or more lines are too long

View File

@ -309,7 +309,8 @@ $available_tags = apply_filters( 'available_permalink_structure_tags', $availabl
/* translators: %s: Permalink structure tag. */
$tag_added = __( '%s added to permalink structure' );
/* translators: %s: Permalink structure tag. */
$tag_removed = __( '%s removed from permalink structure' );
/* translators: %s: Permalink structure tag. */
$tag_already_used = __( '%s (already used in permalink structure)' );
?>
@ -378,6 +379,7 @@ printf(
class="button button-secondary"
aria-label="<?php echo esc_attr( sprintf( $explanation, $tag ) ); ?>"
data-added="<?php echo esc_attr( sprintf( $tag_added, $tag ) ); ?>"
data-removed="<?php echo esc_attr( sprintf( $tag_removed, $tag ) ); ?>"
data-used="<?php echo esc_attr( sprintf( $tag_already_used, $tag ) ); ?>">
<?php echo '%' . $tag . '%'; ?>
</button>

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.1-alpha-53910';
$wp_version = '6.1-alpha-53911';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.