Deepcrawl is now Lumar. Read more.
DeepcrawlはLumarになりました。 詳細はこちら

Role=”text” has focusable descendant (A11y Best Practice Violation)

Post cover image showing clasped hands - representing website accessibility projects
NULL NULL
 

What does this accessibility issue mean?

To comply with website accessibility best practices, check that all elements that require text content have text content defined.

For example, if an element has the role=”button” attribute, it should have text content that describes the button’s purpose.

This is important for ensuring that assistive technology users can properly understand and interact with the content of a webpage, even if they cannot see or access the non-text content directly.

Issue details
  • WCAG Level BP
  • Severity: Serious
  • Category: Aria (BP)
  • Rule ID: aria-text

Lumar can help you find & resolve this website accessibility issue — & many others — on your own site. Speak to our team to get started with the platform.

Get a Lumar demo
 

Example HTML violation: Role=”text” has focusable descendant (A11y Best Practice Violation)

<!DOCTYPE html>
<html lang="en" class="no-js">
  <head></head>
  <body>
    <title>Accessibility Violation Example</title>
    <div role="text">
      <a href="#">Click Me!</a>
    </div>
  </body>
</html>

The above HTML violates the aria-text accessibility rule because the role="text" attribute on the div tag is unnecessary and may cause certain assistive technologies to overlook interactions.

 

How to fix "Role=”text” has focusable descendant (A11y Best Practice Violation)" issue

<!DOCTYPE html>
<html lang="en" class="no-js">
  <head>
    <title>Accessibility Compliance Example</title>
  </head>
  <body>
    <div>
      <a href="#">Click Me!</a>
    </div>
  </body>
</html>

In this updated version, I removed role="text" from the div tag. This role was likely causing the violation as it can create unpredictable screen reader behavior.

Here are further quick tips for ensuring your HTML is always accessible:

  • Always provide meaningful alternative text for images using alt attributes.
  • Ensure form inputs have associated labels
  • Use semantic elements when possible. For example, use <nav> for navigation sections and <footer> for footers.
  • Use ARIA roles and properties when necessary, but do not overuse them, as they can create more problems than they solve if used incorrectly.

Maintaining accessibility in your code not only ensures compliance with standards, but also improves overall user experience, usability and will often have SEO benefits as well.

To find out more about making accessible websites, you can check out the Web Content Accessibility Guidelines (WCAG) provided by W3C's Web Accessibility Initiative.

 
Digital Accessibility + SEO + Website Health

Build better online experiences — explore the full Lumar platform