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
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const aria_accessiblename_exists: Rule = {
"toolkitLevel": eToolkitLevel.LEVEL_ONE,
reasonCodes: ["fail_no_accessible_name_image"]
}],
act: [{"23a2a8": {"fail_no_accessible_name_image": "fail"}}],
act: [{"23a2a8": { "fail_no_accessible_name_image": "fail"}}],
run: (context: RuleContext, options?: {}, contextHierarchies?: RuleContextHierarchy): RuleResult | RuleResult[] => {
const ruleContext = context["dom"].node as Element;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ export const iframe_interactive_tabbable: Rule = {
if (!iframElem || !iframElem.contentDocument || !iframElem.contentDocument.documentElement)
return null;

// If the iframe is blocked by an open modal dialog it is effectively inert — inapplicable
const doc = ruleContext.ownerDocument;
if (doc) {
const dialogs = Array.from(doc.querySelectorAll("dialog"));
const blockedByModal = dialogs.some(d => d.matches(":modal") && !d.contains(ruleContext));
if (blockedByModal) return null;
}

const count = CommonUtil.getTabbableChildren(ruleContext);
if (count > 0)
return RuleFail("fail_invalid");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!DOCTYPE html>

<!--
/******************************************************************************
Copyright:: 2025- IBM, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*****************************************************************************/
-->

<!--
ACT rule 23a2a8 - Image has non-empty accessible name
Failed Example 2: https://www.w3.org/WAI/content-assets/wcag-act-rules/testcases/23a2a8/496963cfd35d4873c010469c47c84d4358fba035.html

A <div> with role="img" and no accessible name (no aria-label, aria-labelledby, or title).
ACT expects: failed
Checker currently returns: inapplicable (nothing fires)
-->

<html lang="en">

<head>
<title>ACT 23a2a8 Failed Example 2 - div with role=img and no accessible name</title>
</head>

<body>
<div role="img" style="width:72px; height:48px; background-image: url(/test-assets/w3c-logo.png)">
</div>

<script type="text/javascript">
UnitTest = {
ruleIds: ["aria_accessiblename_exists"],
results: [{
"ruleId": "aria_accessiblename_exists",
"value": [
"INFORMATION",
"FAIL"
],
"path": {
"dom": "/html[1]/body[1]/div[1]",
"aria": "/document[1]/img[1]"
},
"reasonId": "fail_no_accessible_name_image",
"message": "Element <div> with \"img\" role has no accessible name",
"messageArgs": [
"div",
"img"
],
"apiArgs": [],
"category": "Accessibility"
}]
}
</script>
</body>

</html>
25 changes: 25 additions & 0 deletions accessibility-checker/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,31 @@ module.exports = {
};
```

If your project uses ES modules (`"type": "module"` in `package.json`), Node.js cannot load a CommonJS `aceconfig.js` or `achecker.js` file. Use an `aceconfig.mjs` (or `achecker.mjs`) file with a default export instead:

```js
export default {
ruleArchive: "latest",
policies: ["IBM_Accessibility"],
failLevels: ["violation", "potentialviolation"],
reportLevels: [
"violation",
"potentialviolation",
"recommendation",
"potentialrecommendation",
"manual",
"pass",
],
outputFormat: ["json"],
outputFilenameTimestamp: true,
label: [process.env.TRAVIS_BRANCH],
outputFolder: "results",
baselineFolder: "test/baselines",
cacheFolder: "/tmp/accessibility-checker",
puppeteerArgs: [ "--no-sandbox", "--disable-setuid-sandbox" ]
};
```

## APIs

### async aChecker.getCompliance(`content`, `label` : string)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
// optional - Specify the rule archive
// Default: latest
// Run `npx achecker archives` for a list of valid ruleArchive ids and policy ids
Expand All @@ -11,19 +11,10 @@ module.exports = {
policies: ['IBM_Accessibility'],

// optional - Specify one or many violation levels on which to fail the test
// i.e. If specified violation then the testcase will only fail if
// a violation is found during the scan.
// i.e. failLevels: ["violation"]
// i.e. failLevels: ["violation","potential violation"] or refer to below as a list
// Default: ["violation","potential violation"]
failLevels: ['violation'],

// optional - Specify one or many violation levels which should be reported
// i.e. If specified violation then in the report it would only contain
// results which are level of violation.
// i.e. reportLevels: ["violation"]
// Valid values: violation, potentialviolation, recommendation, potentialrecommendation, manual
// Default: ["violation","potential violation"]
reportLevels: [
"violation",
"potentialviolation",
Expand All @@ -34,24 +25,15 @@ module.exports = {
],

// Optional - Which type should the results be outputted to
// Valid values: json, csv, disable
// Default: json
outputFormat: ['json'],

// Optional - Specify labels that you would like associated to your scan
//
// i.e.
// label: ["Firefox","master","V12","Linux"]
// Default: N/A
label: [],

// optional - Where the scan results should be saved.
// Default: results
outputFolder: '.aat/results',

// optional - Where the baseline results should be loaded from
// Default: baselines
baselineFolder: '.aat/baselines',

captureScreenshots: false
};
};
Loading
Loading