Block support: ariaLabel
This document is part of the WordPress block reference and is intended for developers.
Last updated September 17, 2023.
How to add aria-label to blocks
Among the WordPress core blocks, the arial-label (ariaLabel) block support is exclusively enabled for the group block. This is an accessibility enhancement that lets developers use aria-label to add accessible names to groups without causing block validation errors.
This block support has no interface exposed to users.
ariaLabel is opt-in. You can enable it in your custom block by setting supports > ariaLabel to true:
"supports": {
"ariaLabel": true
}
You can add aria-labels to group blocks in the markup:
<!-- wp:group {"tagName":"aside","layout":{"type":"constrained"}} -->
<aside aria-label="first aside" class="wp-block-group">
<!-- wp:paragraph --><p>Aside 1</p><!-- /wp:paragraph -->
</aside>
<!-- /wp:group -->
View blocks per attribute or block support: