Skip to content

Commit

Permalink
fix(meta-viewport) Don't check zooming/scaling ability in iframe-embe…
Browse files Browse the repository at this point in the history
…dded pages (#2951)

* only check meta-viewport for disabled scaling on the main page, not within iframes

* remove matches that doesn't do anything on a check

* add integration tests

* fix integration test to not use scrdoc and include axe
  • Loading branch information
clottman authored and straker committed Jun 3, 2021
1 parent 3023e69 commit c6829fd
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/rules/meta-viewport-large.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"id": "meta-viewport-large",
"selector": "meta[name=\"viewport\"]",
"matches": "is-initiator-matches",
"excludeHidden": false,
"tags": ["cat.sensory-and-visual-cues", "best-practice"],
"metadata": {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/meta-viewport.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"id": "meta-viewport",
"selector": "meta[name=\"viewport\"]",
"matches": "is-initiator-matches",
"excludeHidden": false,
"tags": ["cat.sensory-and-visual-cues", "best-practice", "ACT"],
"metadata": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<html lang="en">
<head>
<script src="/axe.js"></script>
<meta name="viewport" content="maximum-scale=yes" />
<title>Test Page</title>
</head>
<body>
<main>
<h1>hello world</h1>
</main>
</body>
</html>
12 changes: 12 additions & 0 deletions test/integration/rules/meta-viewport/meta-viewport-pass3.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta id="mvp" name="viewport" content="maximum-scale=2;" />
</head>

<body>
<div id="mocha"></div>
<!-- iframe with zooming disabled should not fail the rule-->
<iframe src="frames/iframe-with-zooming-disabled"></iframe>
</body>
</html>
5 changes: 5 additions & 0 deletions test/integration/rules/meta-viewport/meta-viewport-pass3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"description": "meta-viewport passes when zooming is disabled on an iframe on the page",
"rule": "meta-viewport",
"passes": [["#mvp"]]
}

0 comments on commit c6829fd

Please sign in to comment.