diff --git a/rules/S5260/html/rule.adoc b/rules/S5260/html/rule.adoc index 86122d38930..abd5908ae9d 100644 --- a/rules/S5260/html/rule.adoc +++ b/rules/S5260/html/rule.adoc @@ -36,8 +36,8 @@ This rule raises an issue when the ``++headers++`` attribute of a ``++++`` c Paris - - + + 1 day @@ -47,7 +47,6 @@ This rule raises an issue when the ``++headers++`` attribute of a ``++++`` c 50 euros - diff --git a/rules/S5264/fix.adoc b/rules/S5264/fix.adoc new file mode 100644 index 00000000000..85606f55954 --- /dev/null +++ b/rules/S5264/fix.adoc @@ -0,0 +1,16 @@ +Provide alternative content to ``++++`` elements. + +[source,html,diff-id=1,diff-type=compliant] +---- +This application shows the simulation of two particles colliding + + + Flower growing in a pot + + + + + This application shows the simulation of two particles colliding + + +---- diff --git a/rules/S5264/html/metadata.json b/rules/S5264/html/metadata.json index 7de6471f1ad..2c63c085104 100644 --- a/rules/S5264/html/metadata.json +++ b/rules/S5264/html/metadata.json @@ -1,35 +1,2 @@ { - "title": "\"\" tags should provide an alternative content", - "type": "CODE_SMELL", - "code": { - "impacts": { - "MAINTAINABILITY": "LOW" - }, - "attribute": "COMPLETE" - }, - "status": "ready", - "remediation": { - "func": "Constant\/Issue", - "constantCost": "2min" - }, - "tags": [ - "accessibility", - "wcag2-a" - ], - "extra": { - "replacementRules": [ - - ], - "legacyKeys": [ - - ] - }, - "defaultSeverity": "Minor", - "ruleSpecification": "RSPEC-5264", - "sqKey": "S5264", - "scope": "All", - "defaultQualityProfiles": [ - "Sonar way" - ], - "quickfix": "unknown" } diff --git a/rules/S5264/html/rule.adoc b/rules/S5264/html/rule.adoc index 6f98a917b27..633ddf2f55c 100644 --- a/rules/S5264/html/rule.adoc +++ b/rules/S5264/html/rule.adoc @@ -1,62 +1,5 @@ -== Why is this an issue? +include::../why.adoc[] -Assistive technologies, such as screen readers, will not be able to render ``++++`` elements, in such cases it is the content of the ``++++`` which is provided to the user. This alternative content needs to be accessible or the screen readers won't be able to use it. For example, if an ``++++`` is used it must contain an ``++alt++`` attribute (see corresponding rule Web:ImgWithoutAltCheck). +include::../fix.adoc[] - -This rule raises an issue when an ``++++`` tag does not have any alternative content. - - -=== Noncompliant code example - -[source,html] ----- - - - - - ----- - - -=== Compliant solution - -[source,html] ----- -This application shows the simulation of two particles colliding - - - Flower growing in a pot - - - - - This application shows the simulation of two particles colliding - - ----- - - -== Resources - -* https://www.w3.org/TR/WCAG20-TECHS/H53.html[WCAG2, H53] - Using the body of the object element -* https://www.w3.org/WAI/WCAG21/quickref/?versions=2.0#qr-text-equiv-all[WCAG2, 1.1.1] - Non-text Content -* https://www.w3.org/WAI/WCAG21/quickref/?versions=2.0#qr-media-equiv-audio-desc[WCAG2, 1.2.3] - Audio Description or Media Alternative (Prerecorded) -* https://www.w3.org/WAI/WCAG21/quickref/?versions=2.0#qr-media-equiv-text-doc[WCAG2, 1.2.8] - Media Alternative (Prerecorded) - -ifdef::env-github,rspecator-view[] - -''' -== Implementation Specification -(visible only on this page) - -=== Message - -Add an accessible content to this "" tag. - - -=== Highlighting - -The opening tag without its content - - -endif::env-github,rspecator-view[] +include::../resources.adoc[] \ No newline at end of file diff --git a/rules/S5264/javascript/metadata.json b/rules/S5264/javascript/metadata.json new file mode 100644 index 00000000000..3becfe910fa --- /dev/null +++ b/rules/S5264/javascript/metadata.json @@ -0,0 +1,7 @@ +{ + "tags": [ + "accessibility", + "wcag2-a", + "react" + ] +} \ No newline at end of file diff --git a/rules/S5264/javascript/rule.adoc b/rules/S5264/javascript/rule.adoc new file mode 100644 index 00000000000..633ddf2f55c --- /dev/null +++ b/rules/S5264/javascript/rule.adoc @@ -0,0 +1,5 @@ +include::../why.adoc[] + +include::../fix.adoc[] + +include::../resources.adoc[] \ No newline at end of file diff --git a/rules/S5264/metadata.json b/rules/S5264/metadata.json index 2c63c085104..7de6471f1ad 100644 --- a/rules/S5264/metadata.json +++ b/rules/S5264/metadata.json @@ -1,2 +1,35 @@ { + "title": "\"\" tags should provide an alternative content", + "type": "CODE_SMELL", + "code": { + "impacts": { + "MAINTAINABILITY": "LOW" + }, + "attribute": "COMPLETE" + }, + "status": "ready", + "remediation": { + "func": "Constant\/Issue", + "constantCost": "2min" + }, + "tags": [ + "accessibility", + "wcag2-a" + ], + "extra": { + "replacementRules": [ + + ], + "legacyKeys": [ + + ] + }, + "defaultSeverity": "Minor", + "ruleSpecification": "RSPEC-5264", + "sqKey": "S5264", + "scope": "All", + "defaultQualityProfiles": [ + "Sonar way" + ], + "quickfix": "unknown" } diff --git a/rules/S5264/resources.adoc b/rules/S5264/resources.adoc new file mode 100644 index 00000000000..3501143563c --- /dev/null +++ b/rules/S5264/resources.adoc @@ -0,0 +1,10 @@ +== Resources + +* https://www.w3.org/TR/WCAG20-TECHS/H53.html[WCAG2, H53] - Using the body of the object element +* https://www.w3.org/WAI/WCAG21/quickref/?versions=2.0#qr-text-equiv-all[WCAG2, 1.1.1] - Non-text Content +* https://www.w3.org/WAI/WCAG21/quickref/?versions=2.0#qr-media-equiv-audio-desc[WCAG2, 1.2.3] - Audio Description or Media Alternative (Prerecorded) +* https://www.w3.org/WAI/WCAG21/quickref/?versions=2.0#qr-media-equiv-text-doc[WCAG2, 1.2.8] - Media Alternative (Prerecorded) + +=== Related rules + +* Web:ImgWithoutAltCheck \ No newline at end of file diff --git a/rules/S5264/why.adoc b/rules/S5264/why.adoc new file mode 100644 index 00000000000..7e553c7fc45 --- /dev/null +++ b/rules/S5264/why.adoc @@ -0,0 +1,16 @@ +== Why is this an issue? + +The ``++++`` HTML element represents an external resource, which can be treated as an image, a nested browsing context, or a resource to be handled by a plugin. The element's children are the fallback content. This allows multiple object elements to be nested inside each other, targeting multiple user agents with different capabilities, with the user agent picking the first one it supports. + +Assistive technologies, such as screen readers, will not be able to render ``++++`` elements, in such cases it is the content of the ``++++`` which is provided to the user. This alternative content needs to be accessible or the screen readers won't be able to use it. For example, if an ``++++`` is used it must contain an ``++alt++`` attribute. + +This rule raises an issue when an ``++++`` tag does not have any alternative content. + +[source,html,diff-id=1,diff-type=noncompliant] +---- + + + + + +---- \ No newline at end of file