Home / Function/ hasRole() — react Function Reference

hasRole() — react Function Reference

Architecture documentation for the hasRole() function in DOMAccessibilityRoles.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  9e0f45cd_4f69_a046_c038_f07c79c3beca["hasRole()"]
  96d548f3_c70e_ecfd_0666_850d31986728["DOMAccessibilityRoles.js"]
  9e0f45cd_4f69_a046_c038_f07c79c3beca -->|defined in| 96d548f3_c70e_ecfd_0666_850d31986728
  058ecc0a_0eb4_1971_b88f_7087c8b2613d["getImplicitRole()"]
  9e0f45cd_4f69_a046_c038_f07c79c3beca -->|calls| 058ecc0a_0eb4_1971_b88f_7087c8b2613d
  style 9e0f45cd_4f69_a046_c038_f07c79c3beca fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-dom-bindings/src/client/DOMAccessibilityRoles.js lines 133–140

export function hasRole(element: Element, role: string): boolean {
  const explicitRoles = getExplicitRoles(element);
  if (explicitRoles !== null && explicitRoles.indexOf(role) >= 0) {
    return true;
  }

  return role === getImplicitRole(element);
}

Domain

Subdomains

Frequently Asked Questions

What does hasRole() do?
hasRole() is a function in the react codebase, defined in packages/react-dom-bindings/src/client/DOMAccessibilityRoles.js.
Where is hasRole() defined?
hasRole() is defined in packages/react-dom-bindings/src/client/DOMAccessibilityRoles.js at line 133.
What does hasRole() call?
hasRole() calls 1 function(s): getImplicitRole.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free