Opened 5 weeks ago
Closed 4 weeks ago
#62338 closed feature request (reported-upstream)
wp:template-part assigning an ARIA role
Reported by: | jasonmader | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | |
Component: | Themes | Keywords: | has-patch |
Focuses: | accessibility, template | Cc: |
Description (last modified by )
<!-- wp:template-part {"slug":"news","tagName":"section","role":"complementary","theme":"mytheme"} /-->
If there isn't already a way to give the resulting <section class="wp-block-template-part">
an ARIA role, that would be a nice enhancement.
Change History (4)
#1
@
5 weeks ago
- Description modified (diff)
- Focuses accessibility added; docs removed
- Version 6.6.2 deleted
This ticket was mentioned in PR #7762 on WordPress/wordpress-develop by @sukhendu2002.
4 weeks ago
#2
- Keywords has-patch added
Trac ticket: https://core.trac.wordpress.org/ticket/62338
This PR adds support for specifying an ARIA role on Template Part blocks through block attributes.
For example:
Will output:
<section class="wp-block-template-part" role="main">...</section>
This is particularly useful when:
- The semantic meaning needs to be explicitly defined
- Template parts serve different purposes (e.g., complementary, banner, navigation)
- Additional accessibility context is needed beyond the HTML element
This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.
4 weeks ago
#4
@
4 weeks ago
- Milestone Awaiting Review deleted
- Resolution set to reported-upstream
- Status changed from new to closed
Hi
This ticket was discussed during the Accessibility bug scrub on 12th of November. Here is a summary of the feedback, which is in two parts:
Feature requests for blocks need to be opened in the Gutenberg GitHub repository.
If the proposed pull request would be merged into WordPress directly, then the changes would be overwritten by the updated packages from Gutenberg.
There is already an issue opened about allowing the role attribute on blocks:
https://github.com/WordPress/gutenberg/issues/46002
Like @sabernhardt mentioned, you might not need to use an ARIA role.
Can you add any more information about the use case, where using the appropriate HTML tag for the template part would not be enough?
I will close this Trac ticket as "reported upstream", but please continue the discussion on GitHub.
For the
complementary
role, you could useaside
as thetagName
. (MDN says, "If possible, use the HTML <aside> element instead.") Twenty Twenty-Four uses it in the "Blogging home" pattern.However, could a different role be necessary on the template part container element?