New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve the sidebar banner links accessibility and layout #11234
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CR done
admin/views/sidebar.php
Outdated
@@ -6,17 +6,18 @@ | |||
*/ | |||
|
|||
$wpseo_plugin_dir_url = plugin_dir_url( WPSEO_FILE ); | |||
$new_tab_message = WPSEO_Admin_Utils::get_new_tab_message(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you align the =
by adding some space before it?
admin/views/sidebar.php
Outdated
<strong><a target="_blank" rel="noopener noreferrer" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/jv' ); ?>"><?php esc_html_e( 'Yoast SEO for WordPress course', 'wordpress-seo' ); ?></a></strong><br> | ||
<a href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/jv' ); ?>" target="_blank"> | ||
<img src="<?php echo esc_url( $wpseo_plugin_dir_url . 'images/yoast_seo_for_wp_2.svg' ); ?>" alt=""> | ||
<strong><?php esc_html_e( 'Yoast SEO for WordPress course', 'wordpress-seo' ); ?></strong> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use sprintf for the Yoast
part.
CR done 👍 |
Re: the rel noopener noreferrer thing, please see https://github.com/Yoast/wordpress-seo/issues/4605#issuecomment-425409923 New policy: only use |
3rd CR 👍 |
4th CR 👍 |
Acceptance done 👍 |
Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
Previously, each banner in the sidebar had two links: the image and the text. Although the image has an empty alt attribute
alt=""
it can be still navigated to with screen readers using arrow navigation. Since there's nothing else to announce, screen readers will announce the link URL or part of it:In this case, the best option is to combine the two adjacent links in one single link following this suggested WCAG technique: https://www.w3.org/TR/WCAG20-TECHS/H2.html which also allows to reduce the number of links pointing to the same resource.
rel="noopener noreferrer"
see https://github.com/Yoast/wordpress-seo/issues/4605#issuecomment-425409923WPSEO_Admin_Utils::get_new_tab_message()
to get the accessible, visually hidden, message for links that open in a new browser tabThe only visual change is about the word "Free" (see below), which is now part of the link:before:after:(this can be changed but the translatable string won't be so great)Test instructions
Fixes #10338