Skip to content

Image Block - add an accessibility label input to the link settings #3743

Description

@malalacharm

Describe the bug
The Image/Image Box block fails accessibility audits when a link is applied to the block.

Image Box block: Has an aria-label, but it is incorrectly placed on the outer <div>
Image block: The linked <a> has no aria-label at all

To Reproduce
Steps to reproduce the behavior:

  1. Add an Image Block
  2. Add a Link to the block
  3. Check on frontend
  4. See error in Lighthouse ""Links must have discernible text"

Expected behavior
When a value is provided, the accessibility label should be applied directly to the generated <a> element, ensuring that the link has a discernible and accessible name.

For the Image Box block, the label should no longer be applied only to the outer <div> container. For the Image block, the label should be added to the linked <a> element.

Metadata

Metadata

Assignees

Labels

bugSomething is not workingenhancementImprovement to an existing feature

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions