Skip to content

Commit 2b98639

Browse files
Fix S6793: aria-haspopup must accept values beyond boolean (#294)
1 parent e9621af commit 2b98639

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

sonar-html-plugin/src/main/java/org/sonar/plugins/html/api/accessibility/Aria.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class Aria {
4848
ARIA_PROPERTIES.put("aria-expanded", new AriaProperty("aria-expanded", AriaPropertyType.BOOLEAN, true, "true", "false"));
4949
ARIA_PROPERTIES.put("aria-flowto", new AriaProperty("aria-flowto", AriaPropertyType.IDLIST));
5050
ARIA_PROPERTIES.put("aria-grabbed", new AriaProperty("aria-grabbed", AriaPropertyType.BOOLEAN, true, "true", "false", "undefined"));
51-
ARIA_PROPERTIES.put("aria-haspopup", new AriaProperty("aria-haspopup", AriaPropertyType.BOOLEAN, true, "true", "false", "menu", "listbox", "tree", "grid", "dialog"));
51+
ARIA_PROPERTIES.put("aria-haspopup", new AriaProperty("aria-haspopup", AriaPropertyType.TOKEN, true, "true", "false", "menu", "listbox", "tree", "grid", "dialog"));
5252
ARIA_PROPERTIES.put("aria-hidden", new AriaProperty("aria-hidden", AriaPropertyType.BOOLEAN, true, "true", "false"));
5353
ARIA_PROPERTIES.put("aria-invalid", new AriaProperty("aria-invalid", AriaPropertyType.TOKEN, "true", "false", "grammar", "spelling"));
5454
ARIA_PROPERTIES.put("aria-keyshortcuts", new AriaProperty("aria-keyshortcuts", AriaPropertyType.STRING));

sonar-html-plugin/src/test/java/org/sonar/plugins/html/checks/accessibility/AriaProptypesCheckTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ void html() throws Exception {
4242
.next().atLine(20).withMessage("The value of the attribute \"aria-checked\" must be a boolean or the string \"mixed\".")
4343
.next().atLine(26).withMessage("The value of the attribute \"aria-valuemax\" must be a number.")
4444
.next().atLine(32).withMessage("The value of the attribute \"aria-posinset\" must be a integer.")
45-
.next().atLine(37)
46-
.next().atLine(42)
45+
.next().atLine(38)
4746
.next().atLine(43)
48-
.next().atLine(48).withMessage("The value of the attribute \"aria-controls\" must be a list of strings that represent DOM element IDs (idlist).")
49-
.next().atLine(52).withMessage("The value of the attribute \"aria-details\" must be a string that represents a DOM element ID.")
47+
.next().atLine(44)
48+
.next().atLine(49).withMessage("The value of the attribute \"aria-controls\" must be a list of strings that represent DOM element IDs (idlist).")
49+
.next().atLine(53).withMessage("The value of the attribute \"aria-details\" must be a string that represents a DOM element ID.")
5050
.noMore();
5151
}
5252
}

sonar-html-plugin/src/test/resources/checks/AriaProptypesCheck.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<div aria-posinset="foo" /> <!-- Noncompliant -->
3333

3434
<!-- Token -->
35+
<div aria-haspopup="menu" />
3536
<div aria-orientation="horizontal" />
3637
<div aria-orientation="vertical" />
3738
<div aria-orientation="foo" /> <!-- Noncompliant -->

0 commit comments

Comments
 (0)