Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(region): treat iframes as regions #2614

Merged
merged 1 commit into from
Nov 2, 2020
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
2 changes: 1 addition & 1 deletion lib/checks/navigation/region.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "region",
"evaluate": "region-evaluate",
"options": {
"regionMatcher": "dialog, [role=dialog], svg"
"regionMatcher": "dialog, [role=dialog], svg, iframe"
},
"metadata": {
"impact": "moderate",
Expand Down
8 changes: 8 additions & 0 deletions test/checks/navigation/region.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,14 @@ describe('region', function() {
assert.isTrue(checkEvaluate.apply(checkContext, checkArgs));
});

it('treats iframe elements as regions', function() {
var checkArgs = checkSetup(
'<iframe id="target"></iframe><div role="main">Content</div>'
);

assert.isTrue(checkEvaluate.apply(checkContext, checkArgs));
});

it('returns the outermost element as the error', function() {
var checkArgs = checkSetup(
'<div id="target"><p>This is random content.</p></div><div role="main"><h1 id="mainheader" tabindex="0">Introduction</h1></div>'
Expand Down
12 changes: 12 additions & 0 deletions test/integration/full/region/frames/region.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en" id="violation2">
<head>
<meta charset="utf8" />
<script src="/axe.js"></script>
</head>
<body>
<section aria-label="region">
<p>Region content</p>
</section>
</body>
</html>
2 changes: 2 additions & 0 deletions test/integration/full/region/region-pass.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ <h1 id="hdng">Section heading</h1>
<section aria-label="section 2">
<p>Content</p>
</section>
<iframe id="region-frame" src="frames/region.html"></iframe>
<div id="mocha" role="complementary"></div>
<script src="/test/testutils.js"></script>
<script src="region-pass.js"></script>
<script src="/test/integration/adapter.js"></script>
</body>
Expand Down
13 changes: 6 additions & 7 deletions test/integration/full/region/region-pass.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ describe('region pass test', function() {
'use strict';
var results;
before(function(done) {
axe.run({ runOnly: { type: 'rule', values: ['region'] } }, function(
err,
r
) {
assert.isNull(err);
results = r;
done();
axe.testUtils.awaitNestedLoad(function() {
axe.run({ runOnly: ['region'] }, function(err, r) {
assert.isNull(err);
results = r;
done();
});
});
});

Expand Down