diff --git a/HTMLCS.Util.js b/HTMLCS.Util.js index 1550324e..8381bdc6 100644 --- a/HTMLCS.Util.js +++ b/HTMLCS.Util.js @@ -903,6 +903,8 @@ _global.HTMLCS.util = function() { * - wrongHeaders (Array): Array of elements where headers attr is incorrect. * Each is a structure with following keys: element, * expected [headers attr], actual [headers attr]. + * - isMultiLevelHeadersTable (Boolean): Whether this table has multi-level headers. + * See: https://www.w3.org/WAI/tutorials/tables/multi-level/ * * @param {DOMNode} element Table element to test upon. * @@ -917,7 +919,8 @@ _global.HTMLCS.util = function() { allowScope: true, missingThId: [], missingTd: [], - wrongHeaders: [] + wrongHeaders: [], + isMultiLevelHeadersTable: false, }; var rows = self.getChildrenForTable(element, 'tr'); @@ -1022,6 +1025,7 @@ _global.HTMLCS.util = function() { if ((multiHeaders.rows > 1) || (multiHeaders.cols > 1)) { retval.allowScope = false; + retval.isMultiLevelHeadersTable = true; } else if ((retval.allowScope === true) && ((multiHeaders.rows === 0) || (multiHeaders.cols === 0))) { // If only one column OR one row header. retval.required = false; diff --git a/HTMLCS.js b/HTMLCS.js index 90974d37..0dc354c2 100755 --- a/HTMLCS.js +++ b/HTMLCS.js @@ -84,13 +84,15 @@ _global.HTMLCS = new function() var translations = _global.translation[this.lang]; if (!translations) { - throw new Error ('Missing translations for language ' + this.lang); + console.error('Missing translations for language ' + this.lang); + return ''; } var translation = translations[text]; if (!translation) { - throw new Error('Translation for "' + text + '" does not exist in current language ' + this.lang); + console.error('Translation for "' + text + '" does not exist in current language ' + this.lang); + return ''; } return translation; diff --git a/Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_3/1_3_1.js b/Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_3/1_3_1.js index be429e10..44e7e665 100755 --- a/Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_3/1_3_1.js +++ b/Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_3/1_3_1.js @@ -459,9 +459,13 @@ _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_3_1_3_1 = { } }//end if - // Incorrect usage of headers - error; emit always. - for (var i = 0; i < headersAttr.wrongHeaders.length; i++) { - HTMLCS.addMessage(HTMLCS.ERROR, headersAttr.wrongHeaders[i].element, _global.HTMLCS.getTranslation("1_3_1_H43.IncorrectAttr").replace(/\{\{expected\}\}/g, headersAttr.wrongHeaders[i].expected).replace(/\{\{actual\}\}/g, headersAttr.wrongHeaders[i].actual), 'H43.IncorrectAttr'); + if (headersAttr.isMultiLevelHeadersTable) { + HTMLCS.addMessage(HTMLCS.NOTICE, table, _global.HTMLCS.getTranslation("1_3_1_H43.IncorrectAttrNotice"), 'H43.IncorrectAttr'); + } else { + // Incorrect usage of headers - error; emit always. + for (var i = 0; i < headersAttr.wrongHeaders.length; i++) { + HTMLCS.addMessage(HTMLCS.ERROR, headersAttr.wrongHeaders[i].element, _global.HTMLCS.getTranslation("1_3_1_H43.IncorrectAttr").replace(/\{\{expected\}\}/g, headersAttr.wrongHeaders[i].expected).replace(/\{\{actual\}\}/g, headersAttr.wrongHeaders[i].actual), 'H43.IncorrectAttr'); + } } // Errors where headers are compulsory. diff --git a/Tests/WCAG2/1_3_1_Table_Header_Attr.html b/Tests/WCAG2/1_3_1_Table_Header_Attr.html index 35fa62be..a2d403f4 100644 --- a/Tests/WCAG2/1_3_1_Table_Header_Attr.html +++ b/Tests/WCAG2/1_3_1_Table_Header_Attr.html @@ -13,6 +13,7 @@ Assert: No Error *.H43.MissingHeadersAttrs on #correctTableHeadersComplexRowspan Assert: No Error *.H63.1 on #correctTableHeadersComplexRowspan Assert: No Error *.H43,H63 on #correctTableHeadersComplexRowspan +Assert: No Error *.H43.IncorrectAttr on #multiHeaders -->
@@ -108,5 +109,50 @@ ++ | Example 1 Ltd | +Example 2 Co | +
---|---|---|
Contact | +James Phillips | +Marie Beauchamp | +
Position | +Sales Director | +Sales Manager | +
jp@1ltd.example.com | +marie@2co.example.com | +|
+ | Example 3 Ltd | +Example 4 Inc | +
Contact | +Suzette Jones | +Alex Howe | +
Position | +Sales Officer | +Sales Director | +
Suz@ltd3.example.com | +howe@4inc.example.com | +