38 lines
1.4 KiB
Plaintext

== Why is this an issue?
include::../../../shared_content/jsts/aria-intro-1.adoc[]
In HTML, certain elements have default roles. Default roles, also known as implicit roles, are roles that are inherently associated with certain HTML elements. These roles provide information about what an element does or the type of content it contains, which is especially useful for assistive technologies like screen readers.
For example, a `<button>` element has a default role of `button`. If you explicitly define the role of a `<button>` element as `button`, it's considered redundant because it's the default role of that element.
== How to fix it in JSX
Remove redundant ARIA role attribute.
=== Code examples
==== Noncompliant code example
[source,javascript,diff-id=1,diff-type=noncompliant]
----
<button role="button" onClick={handleClick}>OK</button>
----
==== Compliant solution
[source,javascript,diff-id=1,diff-type=compliant]
----
<button onClick={handleClick}>OK</button>
----
== Resources
=== Documentation
* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques[Using ARIA: Roles, states, and properties]
* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles[ARIA roles (Reference)]
=== Standards
* W3C - https://www.w3.org/TR/wai-aria-1.2/[Accessible Rich Internet Applications (WAI-ARIA) 1.2]