Compare commits

...

4 Commits

Author SHA1 Message Date
Michal Zgliczynski
935b941e28 Address comment 2024-04-10 15:08:14 +02:00
Michal Zgliczynski
2564e0f6b0 Share rationale 2024-04-09 11:49:23 +02:00
Michal Zgliczynski
2f7006c9ac Update with html rspec 2024-04-09 11:45:05 +02:00
zglicz
e70b576140 Add html to rule S6821 2024-04-09 07:55:13 +00:00
8 changed files with 67 additions and 41 deletions

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]

3
rules/S6821/fix.adoc Normal file
View File

@ -0,0 +1,3 @@
== How to fix it
Check that each element with a defined ARIA role has a valid non-abstract value.

View File

@ -0,0 +1,2 @@
{
}

View File

@ -0,0 +1,21 @@
include::../rationale.adoc[]
include::../fix.adoc[]
[source,html,diff-id=1,diff-type=noncompliant]
----
<div role="meth" aria-label="a^{2} + b^{2} = c^{2}">
a<sup>2</sup> + b<sup>2</sup> = c<sup>2</sup>
</div>
----
To fix the code use a valid value for the ARIA role attribute.
[source,html,diff-id=1,diff-type=compliant]
----
<div role="math" aria-label="a^{2} + b^{2} = c^{2}">
a<sup>2</sup> + b<sup>2</sup> = c<sup>2</sup>
</div>
----
include::../common/resources/resources.adoc[]

View File

@ -1,26 +1,2 @@
{ {
"title": "DOM elements with ARIA roles should have a valid non-abstract role",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
"constantCost": "5min"
},
"tags": [
"react",
"accessibility"
],
"defaultSeverity": "Major",
"ruleSpecification": "RSPEC-6821",
"sqKey": "S6821",
"scope": "All",
"defaultQualityProfiles": ["Sonar way"],
"quickfix": "infeasible",
"code": {
"impacts": {
"MAINTAINABILITY": "LOW",
"RELIABILITY": "MEDIUM"
},
"attribute": "LOGICAL"
}
} }

View File

@ -1,14 +1,8 @@
== Why is this an issue? include::../rationale.adoc[]
include::../../../shared_content/jsts/aria-intro-1.adoc[]
This rule checks that when using the `role` property in DOM elements, its value is a valid non-abstract ARIA role.
This rule does not cover non-DOM elements, such as custom components. This rule does not cover non-DOM elements, such as custom components.
== How to fix it in JSX include::../fix.adoc[]
Check that each element with a defined ARIA role has a valid non-abstract value.
[source,javascript,diff-id=1,diff-type=noncompliant] [source,javascript,diff-id=1,diff-type=noncompliant]
---- ----
@ -26,12 +20,4 @@ To fix the code use a valid value for the ARIA role attribute.
</div> </div>
---- ----
== Resources include::../common/resources/resources.adoc[]
=== 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,2 +1,26 @@
{ {
"title": "DOM elements with ARIA roles should have a valid non-abstract role",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
"constantCost": "5min"
},
"tags": [
"react",
"accessibility"
],
"defaultSeverity": "Major",
"ruleSpecification": "RSPEC-6821",
"sqKey": "S6821",
"scope": "All",
"defaultQualityProfiles": ["Sonar way"],
"quickfix": "infeasible",
"code": {
"impacts": {
"MAINTAINABILITY": "LOW",
"RELIABILITY": "MEDIUM"
},
"attribute": "LOGICAL"
}
} }

View File

@ -0,0 +1,5 @@
== Why is this an issue?
include::../../shared_content/jsts/aria-intro-1.adoc[]
This rule checks that when using the `role` property in DOM elements, its value is a valid non-abstract ARIA role.