-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create rule S6824: Add the rule implementation for html (#3852)
* Add html to rule S6824 * Update PR with shared message --------- Co-authored-by: zglicz <[email protected]> Co-authored-by: Michal Zgliczynski <[email protected]>
- Loading branch information
1 parent
f1aee8c
commit 4250db6
Showing
6 changed files
with
59 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
== Why is this an issue? | ||
|
||
include::../../../shared_content/jsts/aria-intro-1.adoc[] | ||
|
||
This rule checks that ARIA roles or `aria-*` attributes are not used in unsupported DOM elements, which are mostly invisible such as `meta`, `html` or `head`. | ||
|
||
== How to fix it | ||
|
||
Check if you are using ARIA roles or `aria-*` attributes in unsupported DOM elements. | ||
|
||
[source,javascript,diff-id=1,diff-type=noncompliant] | ||
---- | ||
<title aria-hidden="false">My beautiful web page</title> | ||
---- | ||
|
||
To fix the code, remove the extra ARIA role or `aria-*` attributes from the unsupported DOM elements. | ||
|
||
[source,javascript,diff-id=1,diff-type=compliant] | ||
---- | ||
<title>My beautiful web page</title> | ||
---- | ||
|
||
== 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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include::../common/rule.adoc[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,2 @@ | ||
{ | ||
"title": "No ARIA role or property for unsupported DOM elements", | ||
"type": "CODE_SMELL", | ||
"status": "ready", | ||
"remediation": { | ||
"func": "Constant\/Issue", | ||
"constantCost": "5min" | ||
}, | ||
"tags": [ | ||
"react", | ||
"accessibility" | ||
], | ||
"defaultSeverity": "Major", | ||
"ruleSpecification": "RSPEC-6824", | ||
"sqKey": "S6824", | ||
"scope": "All", | ||
"defaultQualityProfiles": ["Sonar way"], | ||
"quickfix": "targeted", | ||
"code": { | ||
"impacts": { | ||
"MAINTAINABILITY": "LOW", | ||
"RELIABILITY": "LOW" | ||
}, | ||
"attribute": "CONVENTIONAL" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1 @@ | ||
== Why is this an issue? | ||
|
||
include::../../../shared_content/jsts/aria-intro-1.adoc[] | ||
|
||
This rule checks that ARIA roles or `aria-*` attributes are not used in unsupported DOM elements, which are mostly invisible such as `meta`, `html` or `head`. | ||
|
||
== How to fix it in JSX | ||
|
||
Check if you are using ARIA roles or `aria-*` attributes in unsupported DOM elements. | ||
|
||
[source,javascript,diff-id=1,diff-type=noncompliant] | ||
---- | ||
<title aria-hidden="false">My beautiful web page</title> | ||
---- | ||
|
||
To fix the code, remove the extra ARIA role or `aria-*` attributes from the unsupported DOM elements. | ||
|
||
[source,javascript,diff-id=1,diff-type=compliant] | ||
---- | ||
<title>My beautiful web page</title> | ||
---- | ||
|
||
== 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] | ||
include::../common/rule.adoc[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,26 @@ | ||
{ | ||
"title": "No ARIA role or property for unsupported DOM elements", | ||
"type": "CODE_SMELL", | ||
"status": "ready", | ||
"remediation": { | ||
"func": "Constant\/Issue", | ||
"constantCost": "5min" | ||
}, | ||
"tags": [ | ||
"react", | ||
"accessibility" | ||
], | ||
"defaultSeverity": "Major", | ||
"ruleSpecification": "RSPEC-6824", | ||
"sqKey": "S6824", | ||
"scope": "All", | ||
"defaultQualityProfiles": ["Sonar way"], | ||
"quickfix": "targeted", | ||
"code": { | ||
"impacts": { | ||
"MAINTAINABILITY": "LOW", | ||
"RELIABILITY": "LOW" | ||
}, | ||
"attribute": "CONVENTIONAL" | ||
} | ||
} |