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

Fix: Accessibility issue with links listing blocks. #(64051) #66866

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 5 additions & 3 deletions packages/block-library/src/categories/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,11 @@ export default function CategoriesEdit( {
) }
{ ! isResolving &&
categories?.length > 0 &&
( displayAsDropdown
? renderCategoryDropdown()
: renderCategoryList() ) }
( displayAsDropdown ? (
renderCategoryDropdown()
) : (
<nav>{ renderCategoryList() }</nav>
) ) }
carolinan marked this conversation as resolved.
Show resolved Hide resolved
</TagName>
);
}
2 changes: 1 addition & 1 deletion packages/block-library/src/categories/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function render_block_core_categories( $attributes, $content, $block ) {
} else {
$args['show_option_none'] = $taxonomy->labels->no_terms;

$wrapper_markup = '<ul %1$s>%2$s</ul>';
$wrapper_markup = '<nav><ul %1$s>%2$s</ul></nav>';
carolinan marked this conversation as resolved.
Show resolved Hide resolved
$items_markup = wp_list_categories( $args );
$type = 'list';

Expand Down
6 changes: 5 additions & 1 deletion packages/block-library/src/page-list/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ function BlockContent( {
}

if ( pages.length > 0 ) {
return <ul { ...innerBlocksProps }></ul>;
return (
<nav>
<ul { ...innerBlocksProps }></ul>
</nav>
);
carolinan marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
5 changes: 2 additions & 3 deletions packages/block-library/src/page-list/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,8 @@ function render_block_core_page_list( $attributes, $content, $block ) {
);

return sprintf(
$wrapper_markup,
$wrapper_attributes,
$items_markup
'<nav>%s</nav>',
sprintf( $wrapper_markup, $wrapper_attributes, $items_markup )
);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/tag-cloud/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function render_block_core_tag_cloud( $attributes ) {
$wrapper_attributes = get_block_wrapper_attributes();

return sprintf(
'<p %1$s>%2$s</p>',
'<nav %1$s>%2$s</nav>',
Copy link
Contributor

Choose a reason for hiding this comment

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

This works well in my test, but the nav needs a unique label. It also needs to take into the account that more than one of copy of the tag cloud block can be used on the same page.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @carolinan ,

I have addressed the changes you suggested earlier. Could you please guide me on the changes I need to make based on this comment? I am unsure.

$wrapper_attributes,
$tag_cloud
);
Expand Down
Loading