-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
base: trunk
Are you sure you want to change the base?
Fix: Accessibility issue with links listing blocks. #(64051) #66866
Conversation
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @im3dabasia! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Hi @im3dabasia I do not believe that this is the correct solution for this problem. I also believe that the problem and use case needs to be described in more detail before a solution can be proposed. I recommend allowing some more time to discuss the issue first. The Also when there is more than one nav on a page, visitors need to be able to distinguish one nav from the other. |
@@ -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>', |
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.
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.
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.
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.
Thank you for the feedback, @carolinan! I'll hold off on any additional changes until there's further discussion on the issue's scope and proposed solution. |
My concern is the page list block, if that can be separated I think work on the other two blocks can continue. |
Thank you for the reply @carolinan. I will start working on the other 2 blocks but I need some guidance. In the category list block. The suggestion was to change the constant tagName to 'nav' instead of 'ul', Here I had a doubt since the function renderCategoryList() returns a array of
This would result in wrong markup. I am confused here on how to approach this. Any guidance on this would be much appreciated |
@im3dabasia I think you can change the |
I found that the tag cloud has a There aren't many examples of adding aria labels that are editable by the user. The navigation block uses one, and there is a suggestion to add one to the group block.
The categories are different because it already has a label text that is used when the dropdown option is selected. |
Hey @carolinan I am new to contributing and just want to verify if I need to do the following: a) Enable ariaLabel support in block.json. Please let me know if I’m on the right track or if there’s anything I’m missing. |
Yes. |
Hi @carolinan, I have implemented the requested changes and added support for the aria-label, allowing the user to customize it. By default, the name is set to "Tag Cloud", but the user has the option to modify it in the Advanced section of the Inspector Controls. Attaching a video reference for the same: Screen.Recording.2024-12-06.at.4.26.43.PM.movPlease take a look at the changes, and I would appreciate any feedback you may have. Thank you! |
What?
Fixes #64051.
Why?
This PR addresses accessibility by ensuring screen readers recognize these blocks as navigational elements, as per issue #64051.
How?
Added
<nav>
wrappers around the lists incore/page-list
andcore/tag-cloud
blocks. Forcore/categories
, the<nav>
is conditionally added when displayed as a list (not as a dropdown), improving accessibility.Screenshots or screencast