Skip to content
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

Try: more accessible labels. #29659

Merged
merged 2 commits into from
Mar 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/block-library/src/social-link/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ function render_block_core_social_link( $attributes, $content, $block ) {

$service = ( isset( $attributes['service'] ) ) ? $attributes['service'] : 'Icon';
$url = ( isset( $attributes['url'] ) ) ? $attributes['url'] : false;
$label = ( isset( $attributes['label'] ) ) ? $attributes['label'] : block_core_social_link_get_name( $service );
$label = ( isset( $attributes['label'] ) ) ? $attributes['label'] : sprintf(
/* translators: %1$s: Social-network name. %2$s: URL. */
__( '%1$s: %2$s', 'gutenberg' ),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it really need to be applied in the translation? It looks like sprintf is enough.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's not in the translation, then how would an RTL language reverse it, or how would French add a space before the :? 🤔

Copy link
Member

@gziolo gziolo Mar 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see now it's only used with aria-label so it's going to be read by the assistive technology which is yet another set of challenges. No idea, how to approach it 🤷🏻

block_core_social_link_get_name( $service ),
$url
);
$class_name = isset( $attributes['className'] ) ? ' ' . $attributes['className'] : false;

// Don't render a link if there is no URL set.
Expand Down