Fix S6822: Missing resources (#3905)
This commit is contained in:
parent
6f40329a15
commit
ff00ed21c4
6
rules/S6822/common/fix.adoc
Normal file
6
rules/S6822/common/fix.adoc
Normal 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>
|
||||
----
|
@ -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>
|
||||
----
|
@ -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]
|
@ -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[]
|
@ -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[]
|
Loading…
x
Reference in New Issue
Block a user