Repository navigation
v2.0.0 Automatically add aria-hidden to image tags with empty alt
New Feature: Render Filters Class
In this release, we've added a new class, Render_Filters, to enhance the accessibility of image blocks in your WordPress site.
The Render_Filters class automatically adds the aria-hidden attribute to the HTML of any image block that has an empty alt attribute. This helps screen readers ignore these images, improving the browsing experience for users with visual impairments.
Here's a brief overview of the methods in the Render_Filters class:
__construct(): This method adds therender_blockfilter, which is used to modify the block's HTML.add_aria_label_to_empty_alt_tags(string $block_content, array $block): This method checks if the block is an image block and if thealtattribute is empty. If both conditions are met, it addsaria-hidden="true"to the<img>tag in the block's HTML.
This new feature is part of our ongoing commitment to making your WordPress site as accessible as possible. We hope it helps you serve your users better.