Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Standards/WCAG2AAA/Sniffs/Principle3/Guideline3_2/3_2_2.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,28 @@ _global.HTMLCS_WCAG2AAA_Sniffs_Principle3_Guideline3_2_3_2_2 = {
}
}//end if

if (ok === false) {
// Look for buttons with form attributes, outside of the form.
if (form.id) {
var externalButtons = document.querySelectorAll('button[form], input[form][type=submit], input[form][type=image]');
externalButtons.forEach(
function(el) {
// Check they aren't reset buttons, or normal buttons.
switch (el.getAttribute('type')) {
case 'reset':
case 'button':
return;
}

// Confirm they are associated with the form.
if (el.attributes['form'].value === form.id) {
ok = true;
}
}
);
}
}

if (ok === false) {
HTMLCS.addMessage(
HTMLCS.ERROR,
Expand Down
4 changes: 4 additions & 0 deletions Tests/WCAG2/3_2_2_Form_Input.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Standard: WCAG2AAA
Assert: Error *.H32.2 on #missingSubmit
Assert: No Error *.H32.2 on #defaultSubmitType
Assert: No Error *.H32.2 on #externalSubmitType
-->
</head>
<body>
Expand All @@ -17,5 +18,8 @@
<button>Submit</button>
</form>

<form id="externalSubmitType"></form>
<button form="externalSubmitType">Submit</button>

</body>
</html>