mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-05-20 11:14:28 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@53911 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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 + '/', '' );
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user