Skip to content

Commit

Permalink
Use <nav> with aria-label for Comments Pagination block to improve ac…
Browse files Browse the repository at this point in the history
…cessibility
  • Loading branch information
dhananjaykuber committed Jul 10, 2024
1 parent ac01698 commit c67fdb8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion packages/block-library/src/comments-pagination/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ export default function QueryPaginationEdit( {
</PanelBody>
</InspectorControls>
) }
<div { ...innerBlocksProps } />
<nav { ...innerBlocksProps } aria-label={ __( 'Comments' ) }>
<span className="screen-reader-text">
{ __( 'Comments navigation' ) }
</span>
{ innerBlocksProps.children }
</nav>
</>
);
}
4 changes: 3 additions & 1 deletion packages/block-library/src/comments-pagination/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ function render_block_core_comments_pagination( $attributes, $content ) {
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );

return sprintf(
'<div %1$s>%2$s</div>',
'<nav %1$s aria-label="%2$s"><span class="screen-reader-text">%3$s</span>%4$s</nav>',
$wrapper_attributes,
__( 'Comments' ),
__( 'Comments navigation' ),
$content
);
}
Expand Down

0 comments on commit c67fdb8

Please sign in to comment.