Skip to content

Commit bf4b384

Browse files
committed
Accessibility: Add "(opens in a new window)" screen reader text to the "News-Nearby Events" dashboard widget footer links.
- standardizes similar messages in core to always use `(opens in a new window)` - adds translators comments - hides the dashicons with `aria-hidden="true"`, see #40428 Fixes #40733. git-svn-id: https://develop.svn.wordpress.org/trunk@40643 602fd350-edb4-49c9-b593-d223f7449a82
1 parent e59c9d3 commit bf4b384

4 files changed

Lines changed: 37 additions & 12 deletions

File tree

src/wp-admin/css/dashboard.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,12 @@
440440
color: #ddd;
441441
}
442442

443+
/* Safari 10 + VoiceOver specific: without this, the hidden text gets read out before the link. */
444+
.community-events-footer .screen-reader-text {
445+
height: inherit;
446+
white-space: nowrap;
447+
}
448+
443449
/* Dashboard WordPress news */
444450

445451
#dashboard_primary .inside {

src/wp-admin/includes/dashboard.php

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,22 +1125,40 @@ function wp_dashboard_events_news() {
11251125
</div>
11261126

11271127
<p class="community-events-footer">
1128-
<a href="https://make.wordpress.org/community/meetups-landing-page" target="_blank">
1129-
<?php _e( 'Meetups' ); ?> <span class="dashicons dashicons-external"></span>
1130-
</a>
1128+
<?php
1129+
printf(
1130+
'<a href="%1$s" target="_blank">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
1131+
'https://make.wordpress.org/community/meetups-landing-page',
1132+
__( 'Meetups' ),
1133+
/* translators: accessibility text */
1134+
__( '(opens in a new window)' )
1135+
);
1136+
?>
11311137

11321138
|
11331139

1134-
<a href="https://central.wordcamp.org/schedule/" target="_blank">
1135-
<?php _e( 'WordCamps' ); ?> <span class="dashicons dashicons-external"></span>
1136-
</a>
1140+
<?php
1141+
printf(
1142+
'<a href="%1$s" target="_blank">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
1143+
'https://central.wordcamp.org/schedule/',
1144+
__( 'WordCamps' ),
1145+
/* translators: accessibility text */
1146+
__( '(opens in a new window)' )
1147+
);
1148+
?>
11371149

11381150
|
11391151

1140-
<?php // translators: If a Rosetta site exists (e.g. https://es.wordpress.org/news/), then use that. Otherwise, leave untranslated. ?>
1141-
<a href="<?php _e( 'https://wordpress.org/news/' ); ?>" target="_blank">
1142-
<?php _e( 'News' ); ?> <span class="dashicons dashicons-external"></span>
1143-
</a>
1152+
<?php
1153+
printf(
1154+
'<a href="%1$s" target="_blank">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
1155+
/* translators: If a Rosetta site exists (e.g. https://es.wordpress.org/news/), then use that. Otherwise, leave untranslated. */
1156+
esc_url( __( 'https://wordpress.org/news/' ) ),
1157+
__( 'News' ),
1158+
/* translators: accessibility text */
1159+
__( '(opens in a new window)' )
1160+
);
1161+
?>
11441162
</p>
11451163

11461164
<?php

src/wp-admin/includes/meta-boxes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function post_submit_meta_box( $post, $args = array() ) {
5858
$preview_button = sprintf( '%1$s<span class="screen-reader-text"> %2$s</span>',
5959
$preview_button_text,
6060
/* translators: accessibility text */
61-
__( '(link opens in a new window)' )
61+
__( '(opens in a new window)' )
6262
);
6363
?>
6464
<a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview-<?php echo (int) $post->ID; ?>" id="post-preview"><?php echo $preview_button; ?></a>

src/wp-includes/class-wp-customize-manager.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4144,7 +4144,8 @@ public function register_controls() {
41444144
__( 'CSS allows you to customize the appearance and layout of your site with code. Separate CSS is saved for each of your themes. In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key.' ),
41454145
esc_url( __( 'https://codex.wordpress.org/CSS' ) ),
41464146
__( 'Learn more about CSS' ),
4147-
__( '(link opens in a new window)' )
4147+
/* translators: accessibility text */
4148+
__( '(opens in a new window)' )
41484149
),
41494150
) );
41504151

0 commit comments

Comments
 (0)