Popular New Releases in Accessibility Testing
axe-core
Release v4.4.1
equal-access
April 20, 2022
cypress-axe
v0.14.0
ember-a11y-testing
Release 5.0.0
Android-Accessibility-Api
2.0.0
Popular Libraries in Accessibility Testing
by dequelabs javascript
4466 MPL-2.0
Accessibility engine for automated Web UI testing
by addyosmani javascript
1678 Apache-2.0
Accessibility audit tooling for the web (beta)
by IBMa javascript
489 Apache-2.0
IBM Equal Access Accessibility Checker contains tools to automate accessibility checking from a browser or in a continuous development/build environment
by component-driven typescript
461 MIT
Test accessibility with axe-core in Cypress
by AccessLint javascript
432 MPL-2.0
Keep accessibility errors in check.
by open-indy css
410 MIT
Easily check for website accessibility issues
by angular javascript
235 MIT
Runs a set of accessibility audits
by SSAgov javascript
153 NOASSERTION
A tool to test web content for accessibility and 508 compliance.
by acot-a11y typescript
151 MIT
:gem: Accessibility Testing Framework. More accessible web, all over the world.
Trending New libraries in Accessibility Testing
by IBMa javascript
489 Apache-2.0
IBM Equal Access Accessibility Checker contains tools to automate accessibility checking from a browser or in a continuous development/build environment
by acot-a11y typescript
151 MIT
:gem: Accessibility Testing Framework. More accessible web, all over the world.
by Vove7 kotlin
76 Apache-2.0
安卓无障碍服务Api, 为了简化无障碍服务使用,并使用 Kotlin 以提供简洁的Api。
by freee python
49
freee Accessibility Guidelines
by salesforce typescript
47 NOASSERTION
Salesforce Automated Accessibility Testing Libraries
by abhinaba-ghosh typescript
34 MIT
:wheelchair:: Custom commands for Playwright to run accessibility (a11y) checks with axe-core
by dequelabs ruby
9 MPL-2.0
[DEPRECATED] Ruby integration for aXe-core, the accessibility testing engine
by reallymello javascript
4 Apache-2.0
Verbose error reporting for axe accessibility rule violations to use in NightwatchJS
by lpelypenko html
4 MIT
Creates easy to read HTML file from axe-core accessibility results object
Top Authors in Accessibility Testing
1
4 Libraries
4611
2
2 Libraries
83
3
2 Libraries
136
4
2 Libraries
583
5
1 Libraries
7
6
1 Libraries
36
7
1 Libraries
76
8
1 Libraries
9
9
1 Libraries
2
10
1 Libraries
4
1
4 Libraries
4611
2
2 Libraries
83
3
2 Libraries
136
4
2 Libraries
583
5
1 Libraries
7
6
1 Libraries
36
7
1 Libraries
76
8
1 Libraries
9
9
1 Libraries
2
10
1 Libraries
4
Trending Kits in Accessibility Testing
Accessibility Testing is a testing technique to identify the accessibility issues in the application for disabled and elderly users. It checks if the application is usable by people with all abilities and disabilities. It is also known as Accessibility Audit or Accessibility Review. The goal of accessibility testing is to make sure that the persons with disabilities are able to use the application without any difficulty, i.e., they should be able to access all functionalities and information provided by the Application In this list, we will discuss 6 best open-source Java libraries for Accessibility Testing: clean-code-javascript - Clean Code concepts adapted for JavaScript; Tanaguru - Automated accessibility testing tool, with emphasis on reliablity and automation; axe-android - WCAG Accessibility compliance library for Android Applications.
Accessibility testing is crucial to ensure a product is usable by the majority of its target audience. The disabled community represents around 15% of the U.S population, but it is still often overlooked in design and testing efforts. Plus, accessibility testing is not just about people with disabilities, it also aims at making products usable by older people or users with temporary disabilities (e.g., when using a phone with one hand). In this kit, we will review the best JavaScript Accessibility Testing libraries available pa11y - Pa11y is your automated accessibility testing pal; spearmint - accessibilityfirst GUI for generating clean; quail - Accessibility testing in the browser and on the server.
Accessibility testing is a key part of the software development lifecycle. It helps to ensure that your application provides a pleasant experience for users with disabilities. There are many ways to perform accessibility testing, such as visual inspection and assistive technology testing. It is a process of ensuring that software and web applications are accessible to a wide variety of users, including those with disabilities. Accessibility testing can be time-consuming and expensive. To solve this problem, we have created a list of the best open source software for accessibility testing. This kit contains 11 Python libraries that provide a wide range of features and allow you to test multiple platforms including BeeF-Over-Wan - Browser Exploitation Framework; page-lab - PageLab enables web performance, accessibility, SEO, etc testing; Project_CodeNet - support contributions.
Accessibility testing is a testing technique designed to uncover in an accessible manner any potential issues associated with the application's ability to be used by people with different abilities and disabilities. Accessibility testing involves looking at the application from many different angles, including those of assistive technology, internationalization, localization, aging, and cognitive impairment. The goal of accessibility testing is to ensure that all users can access all functionalities and information provided by the application. Following are the 17 best Go libraries A11yTesting -| Material für den Vortrag "Accessibility Testing goes Mainstream; Vault CI Service - Dockerized service for GitLab CI that provides Hashicorp Vault; gorm-expect - Testing framework for easily testing GORMbased data access layers.
Accessibility testing (AT), also known as Accessibility Audit or Accessibility Review, is a software-testing technique used by organizations that develop applications to ensure that the applications are usable by persons with disabilities. The goal of AT is to make sure that persons with disabilities are able to use the application without any difficulty, i.e., they should be able to access all functionalities and information provided by the application. We have created a list of the 6 best open sources Ruby libraries for accessibility testing. This kit contains 6 libraries including stripe-ruby-mock - A mocking library for testing stripe ruby; axe-core-gems - Ruby integration for axecore, the accessibility testing engine; ra11y - Rubybased automated accessibility testing.
Accessibility testing's goal is to make sure that persons with disabilities are able to use an application as easily as possible, i.e., they should be able to access all functionalities and information provided by the application. Accessibility testing is a technique used to identify issues in an application that makes it difficult for disabled and elderly users to use. The goal of accessibility testing is to ensure that disabled users can access all functionalities and information provided by the application without issue. Let's see the best in a class of accessibility libraries for PHP here phoronix-test-suite - Phoronix Test Suite opensource, crossplatform automated testing; centipede - The Simplest automated testing tool on Earth; frontend-test-suite - give love to automated testing.
Accessibility testing is a technique to identify accessibility issues in an application. It checks whether the application is usable by people with different types of disabilities, especially visual impairment and motor disability. The goal of such a test is to make sure that people with disabilities are able to use the application without any difficulty; i.e., they are able to access all functionalities and information provided by the application. Accessibility Testing is a testing technique to ensure that the application under test is usable by people with disabilities like hearing, color blindness, old age and other disabilities. Following are the 17 best C# libraieries MyTested.AspNetCore.Mvc - Fluent testing library for ASP.NET Core MVC; axe-windows - Automated accessibility testing engine for Windows applications; axe-selenium-csharp - using aXe for web accessibility testing.
Trending Discussions on Accessibility Testing
pa11y json configuration file for actions : https://github.com/pa11y/pa11y#actions
How do I pass in arguments non-interactive into a bash file that uses "read"?
@testcafe-community/axe does not report violations that other tools do
False Positives in Cypress-axe Plugin for Accessibility Testing
Fix invalid nested lists with jQuery
Aria-label gives a DAP violation for <option> tag in dropdown
JAWS reads Headings as clickable even though parent div has not click handler associated
Testcafe Accessibility test as a module
Getting error "org.openqa.selenium.JavascriptException: javascript error: eval is disabled" while trying to do accessibility testing using Axe-Core
Espresso AccessibilityChecks Testing Deprecated
QUESTION
pa11y json configuration file for actions : https://github.com/pa11y/pa11y#actions
Asked 2022-Feb-03 at 14:29We use jenkins CI tool for automated accessibility testing provided by pa11y. As such i use the below Jenkinsfile to run the tests.
1node('mypod') {
2
3container('centos') {
4
5def NODEJS_HOME
6env.NODEJS_HOME = "${tool 'Node-12.0.0'}"
7env.PATH="${env.NODEJS_HOME}/bin:${env.PATH}"
8sh "'${env.NODEJS_HOME}'/bin/node --version"
9sh "npm install -g pa11y --unsafe-perm"
10sh "pa11y -V"
11
12sh '''curl -O https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
13 yum -y install ./google-chrome-stable_current_*.rpm
14 yum -y install libXScrnSaver
15 yum -y install atk java-atk-wrapper at-spi2-atk gtk3 libXt'''
16
17withCredentials([file(credentialsId: '***', variable: 'pa11yconfig')]) {
18
19sh "cat $pa11yconfig > config.json"
20
21sh "pa11y --config config.json --ignore WCAG2AA.Principle3.Guideline3_2.3_2_2.H32.2 --ignore WCAG2AA.Principle1.Guideline1_4.1_4_3.G145.Fail --ignore WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail --threshold 6 --reporter cli https://$URL > results.json"
22
23}
24}
25}
It installs the necessary things to run pa11y against the specified URL on linux based node. Windows are too much of a hassle so we use linux for this implementaion. Also to make this work for the browser to launch we use the below config.json file for pa11y to work.
1node('mypod') {
2
3container('centos') {
4
5def NODEJS_HOME
6env.NODEJS_HOME = "${tool 'Node-12.0.0'}"
7env.PATH="${env.NODEJS_HOME}/bin:${env.PATH}"
8sh "'${env.NODEJS_HOME}'/bin/node --version"
9sh "npm install -g pa11y --unsafe-perm"
10sh "pa11y -V"
11
12sh '''curl -O https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
13 yum -y install ./google-chrome-stable_current_*.rpm
14 yum -y install libXScrnSaver
15 yum -y install atk java-atk-wrapper at-spi2-atk gtk3 libXt'''
16
17withCredentials([file(credentialsId: '***', variable: 'pa11yconfig')]) {
18
19sh "cat $pa11yconfig > config.json"
20
21sh "pa11y --config config.json --ignore WCAG2AA.Principle3.Guideline3_2.3_2_2.H32.2 --ignore WCAG2AA.Principle1.Guideline1_4.1_4_3.G145.Fail --ignore WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail --threshold 6 --reporter cli https://$URL > results.json"
22
23}
24}
25}{
26 "chromeLaunchConfig": {
27 "args": [
28 "--no-sandbox",
29 "--disable-setuid-sandbox",
30 "--disable-dev-shm-usage"
31 ]
32 }
33}
All of this works like a charm for any URl we provide. Now we would like to have some advanced configurations for lets say test if login works or filling a form on a webpage of a site so may be use Actions provided by pa11y. How should i merge Actions code into this json configuration file to achieve that. Actions is documented under :- https://github.com/pa11y/pa11y#actions
Any help or suggestions here would be greatly appreciated!
ANSWER
Answered 2022-Feb-03 at 14:29Something like this:
1node('mypod') {
2
3container('centos') {
4
5def NODEJS_HOME
6env.NODEJS_HOME = "${tool 'Node-12.0.0'}"
7env.PATH="${env.NODEJS_HOME}/bin:${env.PATH}"
8sh "'${env.NODEJS_HOME}'/bin/node --version"
9sh "npm install -g pa11y --unsafe-perm"
10sh "pa11y -V"
11
12sh '''curl -O https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
13 yum -y install ./google-chrome-stable_current_*.rpm
14 yum -y install libXScrnSaver
15 yum -y install atk java-atk-wrapper at-spi2-atk gtk3 libXt'''
16
17withCredentials([file(credentialsId: '***', variable: 'pa11yconfig')]) {
18
19sh "cat $pa11yconfig > config.json"
20
21sh "pa11y --config config.json --ignore WCAG2AA.Principle3.Guideline3_2.3_2_2.H32.2 --ignore WCAG2AA.Principle1.Guideline1_4.1_4_3.G145.Fail --ignore WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail --threshold 6 --reporter cli https://$URL > results.json"
22
23}
24}
25}{
26 "chromeLaunchConfig": {
27 "args": [
28 "--no-sandbox",
29 "--disable-setuid-sandbox",
30 "--disable-dev-shm-usage"
31 ]
32 }
33} "chromeLaunchConfig": {
34 "args": [
35 "--no-sandbox",
36 "--disable-setuid-sandbox",
37 "--disable-dev-shm-usage"
38 ],
39 },
40 "reporter": "cli",
41 "threshold": 6,
42 "ignore:" [
43 'WCAG2AA.Principle3.Guideline3_2.3_2_2.H32.2',
44 'WCAG2AA.Principle1.Guideline1_4.1_4_3.G145.Fail',
45 'WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail'
46 ]
47 "actions": [
48 "navigate to $URL",
49 "wait for $ThingToHappen"
50 ]
51}
52
(I also included options that you're currently passing to the CLI directly, in case that's of interest to you)
QUESTION
How do I pass in arguments non-interactive into a bash file that uses "read"?
Asked 2021-Oct-27 at 02:58I have the following shell script:
1#! /bin/bash
2
3. shell_functions/commonShellFunctions.sh
4. shell_functions/settings.sh
5_valid_url=1
6
7echo "Welcome to HATS Accessibility Testing Tool!"
8echo "We recommend using Chrome browser for the best experience."
9echo "What would you like to scan today?"
10
11options=("sitemap file containing links" "website")
12
13select opt in "${options[@]}"
14do
15 case $opt in
16
17 "sitemap file containing links")
18
19 scanType="sitemap"
20 crawler=crawlSitemap
21 prompt_message="Please enter URL to sitemap: "
22 break;;
23
24 "website")
25
26 prompt_website
27 break;;
28
29 "exit")
30 exit;;
31
32 *)
33 echo "Invalid option $REPLY";;
34
35 esac
36
37done
38
39read -p "$prompt_message" page
40
41
42echo $page
43
It was meant to prompt the user, however I wish to use the script in a CI setting where I pass the arguments through the console without prompting.
I'm currently using echo "<ARG1>\n<ARG2>" | bash run.sh
, but I'm wondering if there's a better way to do this.
ANSWER
Answered 2021-Oct-27 at 02:58Use a here-document
1#! /bin/bash
2
3. shell_functions/commonShellFunctions.sh
4. shell_functions/settings.sh
5_valid_url=1
6
7echo "Welcome to HATS Accessibility Testing Tool!"
8echo "We recommend using Chrome browser for the best experience."
9echo "What would you like to scan today?"
10
11options=("sitemap file containing links" "website")
12
13select opt in "${options[@]}"
14do
15 case $opt in
16
17 "sitemap file containing links")
18
19 scanType="sitemap"
20 crawler=crawlSitemap
21 prompt_message="Please enter URL to sitemap: "
22 break;;
23
24 "website")
25
26 prompt_website
27 break;;
28
29 "exit")
30 exit;;
31
32 *)
33 echo "Invalid option $REPLY";;
34
35 esac
36
37done
38
39read -p "$prompt_message" page
40
41
42echo $page
43./run.sh <<EOF
44arg1
45arg2
46EOF
47
QUESTION
@testcafe-community/axe does not report violations that other tools do
Asked 2021-Jun-07 at 09:51I am exploring tools I can use for automated Accessibility Testing and wanted to try axe-core with TestCafe. I am an advocate of TestCafe, I love that is a lightweight tool and doesn't have dependencies on WebDriver. The docs are great and the scripting is easy.
I have however found that @testcafe-community/axe and its predecessor axe-testcafe do not report all violations while axe-core with selenium and axe-webdriverjs do. For example, running with axe-webdriverjs, I have the following code and resulting output showing the violations of a localhost page I am checking -
Code:
1var AxeBuilder = require('axe-webdriverjs');
2var WebDriver = require('selenium-webdriver');
3
4const path = require('path');
5process.env.PATH = path.resolve(`__dirname/../WebDriver/bin/Firefox/0.29.1`) + ':' + process.env.PATH;
6
7var driver = new WebDriver.Builder()
8 .forBrowser('firefox')
9 .build();
10
11driver
12 //.get('https://dequeuniversity.com/demo/mars/')
13 .get('http://localhost:3000')
14 .then(function() {
15 AxeBuilder(driver).analyze(function(err, results) {
16 if (err) {
17 // Handle error somehow
18 }
19 console.log(results.violations);
20 });
21 });
22
Output:
1var AxeBuilder = require('axe-webdriverjs');
2var WebDriver = require('selenium-webdriver');
3
4const path = require('path');
5process.env.PATH = path.resolve(`__dirname/../WebDriver/bin/Firefox/0.29.1`) + ':' + process.env.PATH;
6
7var driver = new WebDriver.Builder()
8 .forBrowser('firefox')
9 .build();
10
11driver
12 //.get('https://dequeuniversity.com/demo/mars/')
13 .get('http://localhost:3000')
14 .then(function() {
15 AxeBuilder(driver).analyze(function(err, results) {
16 if (err) {
17 // Handle error somehow
18 }
19 console.log(results.violations);
20 });
21 });
22> axe-webdriverjs-tests@1.0.0 test1 /Users/nabeen.jamal/gitlab.com/notifications-service/text-messaging-application/tma-test/app/axe-webdriverjs-tests
23> node test/axe.test1.js
24
25[
26 {
27 description: 'Ensures all page content is contained by landmarks',
28 help: 'All page content must be contained by landmarks',
29 helpUrl: 'https://dequeuniversity.com/rules/axe/3.5/region?application=webdriverjs',
30 id: 'region',
31 impact: 'moderate',
32 nodes: [ [Object], [Object] ],
33 tags: [ 'cat.keyboard', 'best-practice' ]
34 }
35]
36
Using @testcafe-community/axe and following the 'How to use' on the project github page (https://github.com/testcafe-community/axe), I have the following code and resulting output which shows no violations of the same localhost page.
Code:
1var AxeBuilder = require('axe-webdriverjs');
2var WebDriver = require('selenium-webdriver');
3
4const path = require('path');
5process.env.PATH = path.resolve(`__dirname/../WebDriver/bin/Firefox/0.29.1`) + ':' + process.env.PATH;
6
7var driver = new WebDriver.Builder()
8 .forBrowser('firefox')
9 .build();
10
11driver
12 //.get('https://dequeuniversity.com/demo/mars/')
13 .get('http://localhost:3000')
14 .then(function() {
15 AxeBuilder(driver).analyze(function(err, results) {
16 if (err) {
17 // Handle error somehow
18 }
19 console.log(results.violations);
20 });
21 });
22> axe-webdriverjs-tests@1.0.0 test1 /Users/nabeen.jamal/gitlab.com/notifications-service/text-messaging-application/tma-test/app/axe-webdriverjs-tests
23> node test/axe.test1.js
24
25[
26 {
27 description: 'Ensures all page content is contained by landmarks',
28 help: 'All page content must be contained by landmarks',
29 helpUrl: 'https://dequeuniversity.com/rules/axe/3.5/region?application=webdriverjs',
30 id: 'region',
31 impact: 'moderate',
32 nodes: [ [Object], [Object] ],
33 tags: [ 'cat.keyboard', 'best-practice' ]
34 }
35]
36import { checkForViolations } from '@testcafe-community/axe';
37
38fixture `TestCafe tests with Axe`
39 //.page `http://example.com`;
40 .page `http://localhost:3000`;
41
42test('Automated accessibility testing', async t => {
43 // do stuff on your page
44 await checkForViolations(t);
45});
46
Output:
1var AxeBuilder = require('axe-webdriverjs');
2var WebDriver = require('selenium-webdriver');
3
4const path = require('path');
5process.env.PATH = path.resolve(`__dirname/../WebDriver/bin/Firefox/0.29.1`) + ':' + process.env.PATH;
6
7var driver = new WebDriver.Builder()
8 .forBrowser('firefox')
9 .build();
10
11driver
12 //.get('https://dequeuniversity.com/demo/mars/')
13 .get('http://localhost:3000')
14 .then(function() {
15 AxeBuilder(driver).analyze(function(err, results) {
16 if (err) {
17 // Handle error somehow
18 }
19 console.log(results.violations);
20 });
21 });
22> axe-webdriverjs-tests@1.0.0 test1 /Users/nabeen.jamal/gitlab.com/notifications-service/text-messaging-application/tma-test/app/axe-webdriverjs-tests
23> node test/axe.test1.js
24
25[
26 {
27 description: 'Ensures all page content is contained by landmarks',
28 help: 'All page content must be contained by landmarks',
29 helpUrl: 'https://dequeuniversity.com/rules/axe/3.5/region?application=webdriverjs',
30 id: 'region',
31 impact: 'moderate',
32 nodes: [ [Object], [Object] ],
33 tags: [ 'cat.keyboard', 'best-practice' ]
34 }
35]
36import { checkForViolations } from '@testcafe-community/axe';
37
38fixture `TestCafe tests with Axe`
39 //.page `http://example.com`;
40 .page `http://localhost:3000`;
41
42test('Automated accessibility testing', async t => {
43 // do stuff on your page
44 await checkForViolations(t);
45});
46nabeen.jamal@DEM-C02DFG1UMD6M axe-testcafe-tests % npx testcafe --config-file cfg/testcaferc.json chrome src/test1.js
47(node:88006) ExperimentalWarning: Conditional exports is an experimental feature. This feature could change at any time
48(node:88006) ExperimentalWarning: Package name self resolution is an experimental feature. This feature could change at any time
49 Running tests in:
50 - Chrome 90.0.4430.212 / macOS 10.15.7
51
52 TestCafe tests with Axe
53 ✓ Automated accessibility testing
54
55
56 1 passed (0s)
57
As the output shows, the @testcafe-community/axe test passes and shows no violations while the axe-webdriverjs (and axe-core with selenium) shows the violation about "all page content contained by landmarks".
Is this a limitation in @testcafe-community/axe, or do you have to specify the rules in the options parameter of axe.run for it to carry out the checks on the rendered content of the loaded page?
ANSWER
Answered 2021-Jun-04 at 16:42The documentation for axe-core states that you need to specify which rules you intend to test against using axe.run
options.
Landmarks are discussed in WCAG 1.3.6., which is a "Level AAA" item. It appears that axe-core is only capable of testing against "Level A" and "Level AA." In your example, the item is not listed by the tool as a WCAG failure, but rather a best-practices recommendation. This may be why it isn't showing up in your other tools.
If you can easily implement this recommendation, then I'd say go ahead and do it. If not, I wouldn't let something like this stop my code from going into production. Landmarks are nice-to-have, but it's far more important that you meet all "Level A" requirements and as many "Level AA" requirements as you reasonably can.
It's worth noting that any automated accessibility testing tool is nothing more than a starting point for manual evaluation. These tools often generate tons of false positives (and sometimes miss important things!) because it's often not possible to algorithmically determine whether something is genuinely useful to human visitors.
I've also seen pages/apps that pass automated tools with no errors (Wave, Axe, etc.), but they are completely impossible to use with assistive technology.
QUESTION
False Positives in Cypress-axe Plugin for Accessibility Testing
Asked 2021-Jan-06 at 09:11I am running accessibility testing using the cypress-axe plugin with cypress and storybook. The cypress-axe
plugin continually gives false positives when having made the required changes.
The false positive is for page-has-heading-one but I clearly have a h1 element present in the screenshot.
Cypress version: 6.1
cypress-axe version: 0.12.0
Here's the html for the element in question:
1<div role="main"class="example-slider">
2 <h1 role="banner">Slider</h1>
3 <mat-slider
4 min="1"
5 max="50"
6 step="0.5"
7 themePalette="primary"
8 id="slide"
9 value="1.5"
10 aria-label="slider"
11 role="contentinfo"
12 >
13 </mat-slider>
14 </div>
15
Thank you ahead of time if anyone can help with this.
ANSWER
Answered 2021-Jan-06 at 09:11Not a false positive.
The second you gave the <h1>
a role
you changed it's semantic meaning.
role="banner"
is effectively the same as <header>
in HTML5, so you have changed your <h1>
into a <header>
element as far as a computer and assistive technology is concerned.
Remove that role="banner"
from your <h1>
and it will work as expected (and be semantically correct).
Also while you are tidying things up <div role="main"
is the same as <main>
, you should always try to use semantically correct native HTML elements where you can as they will make your mark-up cleaner and they have wider support.
QUESTION
Fix invalid nested lists with jQuery
Asked 2020-Aug-14 at 14:19I have been left with a rather large legacy pile of HTML. I have multiple lists that have sub lists that have not been incorporated into list item, although this renders correctly, it still causes a problem in accessibility testing. Is there a jQuery method that allow me to correct this, until I can convince the content providers to do it properly?
1<ul>
2 <li>list</li>
3 <li>list</li>
4 <ul class="shouldBeSublist">
5 <li>list</li>
6 <li>list</li>
7 <li>list</li>
8 </ul>
9 <li>list</li>
10</ul>
11
last failed attempt...
1<ul>
2 <li>list</li>
3 <li>list</li>
4 <ul class="shouldBeSublist">
5 <li>list</li>
6 <li>list</li>
7 <li>list</li>
8 </ul>
9 <li>list</li>
10</ul>
11$("ul ul").append(function () {
12 return this.closest("li");
13});
14
wanted outcome...
1<ul>
2 <li>list</li>
3 <li>list</li>
4 <ul class="shouldBeSublist">
5 <li>list</li>
6 <li>list</li>
7 <li>list</li>
8 </ul>
9 <li>list</li>
10</ul>
11$("ul ul").append(function () {
12 return this.closest("li");
13});
14<ul>
15 <li>list</li>
16 <li>list
17 <ul class="shouldBeSublist">
18 <li>list</li>
19 <li>list</li>
20 <li>list</li>
21 </ul>
22 **</li>**
23 <li>list</li>
24</ul>
25
ANSWER
Answered 2020-Aug-14 at 14:19Select only lists which are children of lists and use jQuery's appendTo()
method to move them to the previous list element:
1<ul>
2 <li>list</li>
3 <li>list</li>
4 <ul class="shouldBeSublist">
5 <li>list</li>
6 <li>list</li>
7 <li>list</li>
8 </ul>
9 <li>list</li>
10</ul>
11$("ul ul").append(function () {
12 return this.closest("li");
13});
14<ul>
15 <li>list</li>
16 <li>list
17 <ul class="shouldBeSublist">
18 <li>list</li>
19 <li>list</li>
20 <li>list</li>
21 </ul>
22 **</li>**
23 <li>list</li>
24</ul>
25$('ul > ul').each(function() {
26 $(this).appendTo($(this).prev('li'));
27});
28
QUESTION
Aria-label gives a DAP violation for <option> tag in dropdown
Asked 2020-Jul-02 at 19:17I am doing Accessibility testing for an Angular project at work. We use JAWS screen reader. We also use a plugin that identifies issues in the UI and reports them as violations. I am getting one for dropdowns that I'm not able to resolve. It is Accessible name does not match or contain the visible label text
.
The code I have for the dropdown is:
1<select *ngIf="!viewMode" formControlName="group" placeholder="select" id="group" data-placement="right">
2 <option value="" [selected]>Select</option>
3 <option attr.aria-label="{{group.title}}" *ngFor="let group of records"
4 [ngValue]="group" data-placement="right" data-toggle="tooltip" title="{{group.title}}">
5 {{group.title | slice:0:30}}
6 <span *ngIf="group.title.length > 30">...</span>
7 </option>
8</select>
9
10
We truncate the text of group.title
and add ellipses ...
if the entire title doesn't fit the fixed width of dropdown. The aria-label
however always has the full title assigned.
Eg. if we have title as Psychology
, maximum characters that we display are 6. Then dropdown will show Psycho...
but the aria-label will stil be `Psychology.
My issue is that whenever the displayed title gets truncated I get a violation as title doesn't match the aria-label
. If I remove the aria-label
the screen reader only reads what is displayed, so it ends up reading the ellipses as dot dot dot
which we don't want. I tried to use a hidden label instead on aria-label inside the option
tag but that didn't work. Can anyone help me with a workaround??
ANSWER
Answered 2020-Jul-02 at 19:17You shouldn't have to manually truncate labels, because that's a pure visual artifact to cop with insufficient space.
CSS should ideally be able to handle this case for you automatically, so that you would just write the full label and don't care at all.
The CSS to do that exists. The property is called text-overflow
with the value èllipsis`.
Example here
However, very often, and even in recent browsers, CSS support for <option>
is very limited and incomplete. IN some browsers, you are even not allowed to change text color.
So, applying text-overflow: ellipsis
certainly won't work, sadly. IN a ideal world this would be by far the best solution.
You shouldn't have to manually truncate labels. If it can't be done automatically for you in CSS in case you lack space, the next best would probably be to reorganize your layout to make sure you have enough space to see entirely the longest label.
You may have a different aria-label than visible text, but generally it isn't recommanded. Hance the warning of your accessibility checker to remind it to you.
It isn't recommanded because several groups of people can have difficulties. For example, partially sighted people or those having dyslexia, who rely both on visible text and speech synthesis, will read the abbreviation but hear the full tex. It can be very confusing.
Third answerIf you really can't rearrange your layout to make all labels visible in full text, ignore the warning, leave the full text in aria-label and the shortened text visible as it is currently.
There are problems for several groups of people, well, but it isn't so bad afterall. It would probably be much worse for accessibility if you decided to switch your <select<
for a custom component.
So I would still strongly advice you to keep your <select>
whatever the situation. Blind people and keyboard only users will thank you.
However, always remember that warnings are never present for nothing. They point you to a potential problem you'd better to solve. This is definitly not a false positive!
QUESTION
JAWS reads Headings as clickable even though parent div has not click handler associated
Asked 2020-Jul-01 at 06:51I am working on accessibility testing for an Angular project. I have some code for a modal that is as below
1<div class="modal fade" bsModal #cancelConfirmModal="bs-modal" tabindex="-1" role="dialog"
2 attr.aria-label="Cancel Modal" aria-hidden="true">
3 <div class="md-dialog modal-md">
4 <!-- Modal content-->
5 <div class="md-content">
6 <div class="md-header">
7 <div class="md-title pull-left">
8 <h4 tabindex=0 class="headerBottomMarginNone"> Cancel</h4>
9 </div>
10 <button type="button" class="close-popup" (click)="hideCancelModal()">
11 <img src="{{ pathImg }}/close.png" alt="Close Icon"
12 (mouseover)="changeCloseIconOnHover('close-popup3')"
13 (mouseout)="changeCloseIcon('close-popup3')" id="close-popup3">
14 <label class="sr-only">Close</label>
15 </button>
16 </div>
17 <div tabindex=0 class="md-body">
18 {{ cancelMessageBody }}
19 </div>
20 <div class="md-footer">
21 <button type="reset pull-right" class="ts-btn ts-btn-primary no-btm-margin" (click)="revert()">Yes</button>
22 <button type="pull-right" (click)="hideCancelModal()"
23 class="ts-btn ts-btn-tertiary margin-left10 no-btm-margin">Cancel</button>
24 </div>
25 </div>
26 </div>
27</div>
28
When I tab over to <h4 tabindex=0 class="headerBottomMarginNone"> Cancel</h4>
it reads Cancel heading level 4 clickable. There is no click event on the parent or even its parent. h4 is made tab reachable as per the QA's preference. How do I stop JAWS from announcing clickable??
ANSWER
Answered 2020-Jul-01 at 06:51Remove the tabindex
.
Headings should not have a tabindex
(other than maybe a tabindex="-1"
, covered below).
Anything with a tabindex
is considered to be interactive and it is expected that you have supplied the relevant handlers for focus, click, keyboard keys etc.
Your QA is incorrect on this and is making the software harder to use.
The only time it is appropriate to use a tabindex
on a heading is if you need to programatically focus it (for example on an AJAX application where you load a new page in it is a good practice to focus the heading level 1 on the page to let screen reader users know the new page has loaded in.) At this point the only tabindex
that is appropriate is tabindex="-1"
so that it can only be focused programatically and not via the tab key.
Your QA may think that screen reader users need to be able to focus the headings, this is not the case! They use shortcut keys within their screen reader to access headings on the page.
Also remove it from <div tabindex=0 class="md-body">
as that is also not interactive.
Finally it is likely you do not need tabindex="-1"
on the modal itself as when you open the modal you should focus either the first interactive element or the close button (which in your case appears to be the cancel button anyway.), however there may be functionality in your software that I am not aware of so that is just a point to consider.
QUESTION
Testcafe Accessibility test as a module
Asked 2020-Jun-03 at 12:25I am trying to include Testcafe aXe tests as a module as follows:
1// a11y.js
2const { axeCheck, createReport } = require('axe-testcafe');
3
4const a11y = async t => {
5 const { error, violations } = await axeCheck(t);
6 await t.expect(violations.length === 0).ok(createReport(violations));
7};
8
9module.exports = {
10 a11y
11};
12
then import in my test file as follows:
1// a11y.js
2const { axeCheck, createReport } = require('axe-testcafe');
3
4const a11y = async t => {
5 const { error, violations } = await axeCheck(t);
6 await t.expect(violations.length === 0).ok(createReport(violations));
7};
8
9module.exports = {
10 a11y
11};
12// mytest.js
13const myModule = require('a11y.js');
14
15fixture `TestCafe tests with Axe`
16 .page `http://example.com`;
17
18test('Automated accessibility testing', async t => {
19 await a11y();
20});
21
The goal is to centralize all tests in this module (there are a bunch of files and tests) and expose the functions to be used everywhere else.
However, I am getting the following error, which based on the read is because axeCheck(t)
has to be inside a test.
1// a11y.js
2const { axeCheck, createReport } = require('axe-testcafe');
3
4const a11y = async t => {
5 const { error, violations } = await axeCheck(t);
6 await t.expect(violations.length === 0).ok(createReport(violations));
7};
8
9module.exports = {
10 a11y
11};
12// mytest.js
13const myModule = require('a11y.js');
14
15fixture `TestCafe tests with Axe`
16 .page `http://example.com`;
17
18test('Automated accessibility testing', async t => {
19 await a11y();
20});
21Automated accessibility testing
22
23 1) with cannot implicitly resolve the test run in context of which it should be executed. If you need to call with from the Node.js API
24 callback, pass the test controller manually via with's `.with({ boundTestRun: t })` method first. Note that you cannot execute with outside
25 the test code.
26
Can this be solved by calling .with({ boundTestRun: t })
? If so, where do I insert that code?
ANSWER
Answered 2020-Jun-03 at 12:25You need to pass the TestController object as a parameter of the a11() function. So, your code will look as follows:
1// a11y.js
2const { axeCheck, createReport } = require('axe-testcafe');
3
4const a11y = async t => {
5 const { error, violations } = await axeCheck(t);
6 await t.expect(violations.length === 0).ok(createReport(violations));
7};
8
9module.exports = {
10 a11y
11};
12// mytest.js
13const myModule = require('a11y.js');
14
15fixture `TestCafe tests with Axe`
16 .page `http://example.com`;
17
18test('Automated accessibility testing', async t => {
19 await a11y();
20});
21Automated accessibility testing
22
23 1) with cannot implicitly resolve the test run in context of which it should be executed. If you need to call with from the Node.js API
24 callback, pass the test controller manually via with's `.with({ boundTestRun: t })` method first. Note that you cannot execute with outside
25 the test code.
26// a11y.js
27
28const { axeCheck, createReport } = require('axe-testcafe');
29
30const a11y = async t => {
31 const { violations } = await axeCheck(t);
32
33 await t.expect(violations.length === 0).ok(createReport(violations));
34};
35
36module.exports = a11y;
37
38
1// a11y.js
2const { axeCheck, createReport } = require('axe-testcafe');
3
4const a11y = async t => {
5 const { error, violations } = await axeCheck(t);
6 await t.expect(violations.length === 0).ok(createReport(violations));
7};
8
9module.exports = {
10 a11y
11};
12// mytest.js
13const myModule = require('a11y.js');
14
15fixture `TestCafe tests with Axe`
16 .page `http://example.com`;
17
18test('Automated accessibility testing', async t => {
19 await a11y();
20});
21Automated accessibility testing
22
23 1) with cannot implicitly resolve the test run in context of which it should be executed. If you need to call with from the Node.js API
24 callback, pass the test controller manually via with's `.with({ boundTestRun: t })` method first. Note that you cannot execute with outside
25 the test code.
26// a11y.js
27
28const { axeCheck, createReport } = require('axe-testcafe');
29
30const a11y = async t => {
31 const { violations } = await axeCheck(t);
32
33 await t.expect(violations.length === 0).ok(createReport(violations));
34};
35
36module.exports = a11y;
37
38// test.js
39const a11y = require('./a11y.js');
40
41fixture `Fixture`
42 .page('http://example.com');
43
44test('test', async t => {
45 await a11y(t);
46});
47
QUESTION
Getting error "org.openqa.selenium.JavascriptException: javascript error: eval is disabled" while trying to do accessibility testing using Axe-Core
Asked 2020-May-16 at 07:40I am trying to do accessibility testing using Axe-Core tool using Java as the Programming language. I was able to get the result from many pages in my application but for one of the page, I am getting error as
1 org.openqa.selenium.JavascriptException: javascript error: eval is disabled
2(Session info: chrome=81.0.4044.138)
3Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
4System info: host: 'XXXX', ip: 'XXXX', os.name: 'Windows 10', os.arch: 'amd64',
5os.version: '10.0', java.version: '1.8.0_131'
6Driver info: org.openqa.selenium.chrome.ChromeDriver
7Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 81.0.4044.138, chrome:
8{chromedriverVersion: 81.0.4044.138 (8c6c7ba89cc9..., userDataDir: C:\Users\NASEEM~1.AHM\AppDa...},
9goog:chromeOptions: {debuggerAddress: localhost:52030}, javascriptEnabled: true,
10networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS,
11proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0,
12pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true}
13Session ID: cbdfe9de190b8224da1ec675bef90966
14
I am getting the above error in the code
1 org.openqa.selenium.JavascriptException: javascript error: eval is disabled
2(Session info: chrome=81.0.4044.138)
3Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
4System info: host: 'XXXX', ip: 'XXXX', os.name: 'Windows 10', os.arch: 'amd64',
5os.version: '10.0', java.version: '1.8.0_131'
6Driver info: org.openqa.selenium.chrome.ChromeDriver
7Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 81.0.4044.138, chrome:
8{chromedriverVersion: 81.0.4044.138 (8c6c7ba89cc9..., userDataDir: C:\Users\NASEEM~1.AHM\AppDa...},
9goog:chromeOptions: {debuggerAddress: localhost:52030}, javascriptEnabled: true,
10networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS,
11proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0,
12pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true}
13Session ID: cbdfe9de190b8224da1ec675bef90966
14 JSONObject responseJSON = new AXE.Builder(driver, scriptUrl).analyze();
15
I am getting this error while running the test in Chrome browser. I executed the same code in Firefox browser and there I was able to run it without any issue.
Anything which I should add while running the test? Any Desired Capabilities should I include?
Please suggest.
ANSWER
Answered 2020-May-16 at 07:40My suspicion is that you are getting this error as the site you are testing has a content security policy
A Content Security Policy (CSP) allows a website owner to protect their end users by ensuring no malicious third party JS, CSS images etc. are injected into the site. Anything included in the CSP is allowed, anything not included is blocked.
Within a CSP it will block JavaScript eval
function, which is required in your programme.
The site owner would have to explicitly allow eval
on their site (as it is blocked by default if you have any JS rules in your CSP) by adding unsafe-eval
as one of the rules on their CSP.
Taken from the page I linked on CSP:-
'unsafe-eval'
Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes.
The only way you could fix this is by asking the owner of the site to add that to their CSP or by changing whichever function is injecting eval
into their site.
If you want another site to test to confirm it is CSP that is blocking your script you can try mine https://klu.io as my CSP is very strict.
Update after conversationsIt appears I got the problem correct but not the cause.
This was being caused by the website overriding window.eval
to throw an error (basically disabling it). The following fiddle demonstrates this behaviour in it's most basic form.
1 org.openqa.selenium.JavascriptException: javascript error: eval is disabled
2(Session info: chrome=81.0.4044.138)
3Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
4System info: host: 'XXXX', ip: 'XXXX', os.name: 'Windows 10', os.arch: 'amd64',
5os.version: '10.0', java.version: '1.8.0_131'
6Driver info: org.openqa.selenium.chrome.ChromeDriver
7Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 81.0.4044.138, chrome:
8{chromedriverVersion: 81.0.4044.138 (8c6c7ba89cc9..., userDataDir: C:\Users\NASEEM~1.AHM\AppDa...},
9goog:chromeOptions: {debuggerAddress: localhost:52030}, javascriptEnabled: true,
10networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS,
11proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0,
12pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true}
13Session ID: cbdfe9de190b8224da1ec675bef90966
14 JSONObject responseJSON = new AXE.Builder(driver, scriptUrl).analyze();
15window.eval = function(){
16 throw new Error("window.eval is disabled");
17}
18
19eval(1);
There isn't much you can do at this point without rewriting Axe-Core to not use eval
as it obviously injects this into the Window being tested at some point.
The only idea I have (if someone else stumbles across this problem) to fix this would be to replace the offending script with one that has the function that overrides window.eval
with a duplicate that has every other function cloned other than the one that blocks the script running. However if they are disabling window.eval
then it is highly likely that they are also using a CSP and so you wouldn't be able to inject a script.
QUESTION
Espresso AccessibilityChecks Testing Deprecated
Asked 2020-Jan-17 at 21:47I am automating accessibility testing with espresso, but it reports that androidx.test.espresso.contrib.AccessibilityChecks
as deprecated.
I surfed the internet and found the non-deprecated AccessibilityChecks
class which should be used instead. But would be appreciate if anyone can provide the non-deprecated gradle dependency
This is my testing class
1import androidx.test.espresso.contrib.AccessibilityChecks;
2import androidx.test.ext.junit.runners.AndroidJUnit4;
3
4import org.junit.BeforeClass;
5import org.junit.runner.RunWith;
6
7@RunWith(AndroidJUnit4.class)
8public class AccessibilityChecksTest {
9
10 @BeforeClass
11 public static void turnOnAccessibility() {
12 AccessibilityChecks.enable();
13 }
14
15}
16
Dependency
1import androidx.test.espresso.contrib.AccessibilityChecks;
2import androidx.test.ext.junit.runners.AndroidJUnit4;
3
4import org.junit.BeforeClass;
5import org.junit.runner.RunWith;
6
7@RunWith(AndroidJUnit4.class)
8public class AccessibilityChecksTest {
9
10 @BeforeClass
11 public static void turnOnAccessibility() {
12 AccessibilityChecks.enable();
13 }
14
15}
16androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.2.0'
17
ANSWER
Answered 2020-Jan-17 at 21:47The below is the right dependency for the non-deprecated AccessibilityChecks
I found it here along with many other Espresso
testing APIs
1import androidx.test.espresso.contrib.AccessibilityChecks;
2import androidx.test.ext.junit.runners.AndroidJUnit4;
3
4import org.junit.BeforeClass;
5import org.junit.runner.RunWith;
6
7@RunWith(AndroidJUnit4.class)
8public class AccessibilityChecksTest {
9
10 @BeforeClass
11 public static void turnOnAccessibility() {
12 AccessibilityChecks.enable();
13 }
14
15}
16androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.2.0'
17 androidTestImplementation 'androidx.test.espresso:espresso-accessibility:3.2.0'
18
Community Discussions contain sources that include Stack Exchange Network
Tutorials and Learning Resources in Accessibility Testing
Tutorials and Learning Resources are not available at this moment for Accessibility Testing