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

Footnotes: Add aria-label to return links #54843

Merged
merged 4 commits into from
Sep 28, 2023
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
9 changes: 7 additions & 2 deletions packages/block-library/src/footnotes/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,20 @@ function render_block_core_footnotes( $attributes, $content, $block ) {
}

$wrapper_attributes = get_block_wrapper_attributes();
$footnote_index = 1;

$block_content = '';

foreach ( $footnotes as $footnote ) {
// Translators: %d: Integer representing the number of return links on the page.
$aria_label = sprintf( __( 'Jump to footnote reference %1$d' ), $footnote_index );
$block_content .= sprintf(
'<li id="%1$s">%2$s <a href="#%1$s-link">↩︎</a></li>',
'<li id="%1$s">%2$s <a href="#%1$s-link" aria-label="%3$s">↩︎</a></li>',
$footnote['id'],
$footnote['content']
$footnote['content'],
$aria_label
);
++$footnote_index;
}

return sprintf(
Expand Down
Loading