[wp-trac] [WordPress Trac] #47670: RSS widget creates and accessibility problem when used more than once
WordPress Trac
noreply at wordpress.org
Tue Jul 9 18:49:02 UTC 2019
#47670: RSS widget creates and accessibility problem when used more than once
---------------------------+-----------------------------
Reporter: tpaw | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Widgets | Version:
Severity: normal | Keywords:
Focuses: accessibility |
---------------------------+-----------------------------
Please consider the following patch to improve accessibility.
Accessibility guidelines in WCAG's standard 2.4.4 Link Purpose requires
that link text should provide a purpose or context for the link.
In the RSS widget, the link text for the link to the RSS feed itself is an
image of the RSS icon; its alt text is "RSS" which programmatically
determines the link text. This passes the referenced standard.
A problem occurs when multiple instances of the RSS widget are used. There
are then multiple links with link text "RSS", each of which lead to
different URLs. The text "RSS" then does not provide enough context for
visitors to know what each "RSS" link leads to.
The solution is the make each RSS link text unique to each feed's title,
thus providing the necessary context.
Simply prepending the title of the widget instance adds the necessary
context to the link text without using any additional words which could
has i18n issues.
In class-wp-widget-rss.php (lines 89-91 in 5.2.2):
From:
{{{#!php
<?php
// lines 89-91 in wp-includes/widgets/class-wp-widget-rss.php (WP 5.2.2)
if ( $title ) {
$title = '<a class="rsswidget" href="' . esc_url( $url ) . '"><img
class="rss-widget-icon" style="border:0" width="14" height="14" src="' .
esc_url( $icon ) . '" alt="RSS" /></a> <a class="rsswidget" href="' .
esc_url( $link ) . '">' . esc_html( $title ) . '</a>';
}
}}}
To:
{{{#!php
<?php
if ( $title ) {
$title = '<a class="rsswidget" href="' . esc_url( $url ) . '"><img
class="rss-widget-icon" style="border:0" width="14" height="14" src="' .
esc_url( $icon ) . '" alt="' . esc_html( $title ) . ' RSS" /></a> <a
class="rsswidget" href="' . esc_url( $link ) . '">' . esc_html( $title ) .
'</a>';
}
}}}
No harm is done when only a single instance of the RSS widget is used
because the RSS link text is simply more explicit.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47670>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list