Fix S6822: Missing resources (#3905)

This commit is contained in:
Victor 2024-04-23 14:21:01 +02:00 committed by GitHub
parent 6f40329a15
commit ff00ed21c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 25 additions and 41 deletions

View File

@ -0,0 +1,6 @@
Remove ARIA role attributes when they are redundant.
[source,html,diff-id=1,diff-type=compliant]
----
<button onClick={handleClick}>OK</button>
----

View File

@ -4,4 +4,9 @@ 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.
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.
[source,html,diff-id=1,diff-type=noncompliant]
----
<button role="button" onClick={handleClick}>OK</button>
----

View File

@ -0,0 +1,9 @@
== 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]

View File

@ -1,23 +1,5 @@
include::../common/indtroduction.adoc[]
include::../common/introduction.adoc[]
== How to fix it in JSX
Remove redundant ARIA role attribute.
=== Code examples
==== Noncompliant code example
[source,html,diff-id=1,diff-type=noncompliant]
----
<button role="button" onClick={handleClick}>OK</button>
----
==== Compliant solution
[source,html,diff-id=1,diff-type=compliant]
----
<button onClick={handleClick}>OK</button>
----
include::../common/fix.adoc[]
include::../common/resources.adoc[]

View File

@ -1,23 +1,5 @@
include::../common/indtroduction.adoc[]
include::../common/introduction.adoc[]
== 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>
----
include::../common/fix.adoc[]
include::../common/resources.adoc[]