-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Add aria-label to code block #16053
Add aria-label to code block #16053
Comments
Hi @CaitBarnard! Thanks for reporting the issue, I added |
Hi @Mati365. That solves the issue perfectly. Thank you for sorting that. |
@CaitBarnard We checked docs, and it seems that |
@Mati365 My bad, that's a good point that I completely overlooked. I believe the pre element can have an aria label. Is it possible to add it there instead? I've seen a few examples where a pre tag has an aria-label but I've yet to test it myself. Another possibility I've seen is wrapping the pre/code in a figure with a figcaption which gets read by the screenreader instead but that feels a bit more hacky. What do you think? |
@CaitBarnard No problem. I'm not sure if we can do that using |
@Mati365 Thank you. I had a look at the PR and it makes sense to me. Should be sufficient :) |
Feature (code-block): Introduced screen reader announcements for entering or exiting code blocks in the editor content. Closes #16053. Feature (image, list, ui): Introduced screen reader announcements for various actions and events in the editor. Other (ui): Refactored the `AriaLiveAnnouncer` utility to use the `aria-relevant` attribute and make concurrent announcements queued by screen readers. MINOR BREAKING CHANGE (ui): The region name argument of the `AriaLiveAnnouncer#announce()` method has been dropped. Please check out the latest API documentation for more information. --------- Co-authored-by: Aleksander Nowodzinski <a.nowodzinski@cksource.com>
📝 Provide a description of the improvement
When you add a code block to the editor, there is a small label on the right that says which language the code block is. This is inaccessible as an assistive technology user may not necessarily be able to pick that label up.
Is it possible to have some sort of event listener on the code blocks which updates the aria-label on this element?
📃 Other details
This is a snippet of how I'm solving the issue currently. However it only fires on change and so doesn't provide an aria-label when loading a page that already has an editor with a code block. It's also not sensible to have a setTimeout which is there as the change trigger takes a moment to generate pre elements and prevents it being null before it's had a moment to update.
If you'd like to see this improvement implemented, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: