Skip to content

Commit ca091ac

Browse files
author
Marcy Sutton
committed
fix: allow mixed casing of caption/summary
Closes #771
1 parent 404cf48 commit ca091ac

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
// passing node.caption to accessibleText instead of using the logic in accessibleTextVirtual on virtualNode
2-
return !!(node.summary && node.caption) && node.summary === axe.commons.text.accessibleText(node.caption);
1+
// passing node.caption to accessibleText instead of using
2+
// the logic in accessibleTextVirtual on virtualNode
3+
return !!(node.summary && node.caption) &&
4+
node.summary.toLowerCase() === axe.commons.text.accessibleText(node.caption).toLowerCase();

test/checks/tables/same-caption-summary.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,20 @@ describe('same-caption-summary', function () {
4242
assert.isTrue(checks['same-caption-summary'].evaluate.apply(checkContext, params));
4343
});
4444

45+
it('should return true if summary and caption are the same with mixed casing', function () {
46+
var params = checkSetup('<table summary="My Table" id="target">' +
47+
'<caption> my table </caption>' +
48+
'<thead>' +
49+
'<tr><th scope="col">Head</th></tr>' +
50+
'</thead>' +
51+
'<tbody>' +
52+
'<tr><td>Data</td></tr>' +
53+
'</tbody>' +
54+
'</table>');
55+
56+
assert.isTrue(checks['same-caption-summary'].evaluate.apply(checkContext, params));
57+
});
58+
4559
(shadowSupport.v1 ? it : xit)('should match slotted caption elements', function () {
4660
var params = shadowCheckSetup(
4761
'<div>' +

0 commit comments

Comments
 (0)