Code Monkey home page Code Monkey logo

kayle's Introduction

A11yWatch Lite

The fast, precise, and sophisticated web accessibility automation tool for staying inclusive

crates.io MIT

en ja es

A11yWatch Lite is a previous and open-source version of A11yWatch (a paid, hosted Web accessibility and Vitals Tool). It was the first version of our software, and has been downloaded a lot!

While we are no longer adding features to this Lite version, we will be continuing to maintain it long-term and fix any bugs that come up.

A11yWatch Lite vs A11yWatch

A11yWatch is much more detailed, feature-rich, efficient, and faster, than A11yWatch Lite. Sign up for A11yWatch today and level up your accessibility automation. We offer high performance API integrations for paid accounts that will save your wallet in folds and better mother nature. Web accessibility automation in the current tools outside of A11yWatch can be very harmful due to the cost for the latency, improper algorithms and protocols that waste tons of energy/cpu cycles, and much more due to the state of the challenges of the job without the expertise and dedication required. A11yWatch leads the way in speed, efficiency, accuracy, and robustness when it comes to testing accessibility with more coverage than any other.

Pre-requisites

  • Rust is required if building locally.
  • Nodejs is required if building locally.
  • Docker is required if you are not building locally.

Installing

The CLI can be used to test and build your own instance anywhere.
We have clients in multiple languages and protocols to integrate with your app easier.
See the documentation for more information on getting started with development and etc.

Getting Started

To get started with the fastest and most precise web accessibility platform pick between the Cloud, CLI, Docker, or Sidecar.

A11yWatch Cloud

A11yWatch Cloud is the fastest way to get started with A11yWatch. It provides managed infrastructure as well as an instant and free access for development projects and concepts.

For a step-by-step guide on A11yWatch Cloud, see the docs.

A11yWatch CLI

A11yWatch CLI is an alternative way to get started with A11yWatch. It brings the tools to manage infrastructure, powerful commands for interactivity, and has the ability to automate workflows using tools like Github Actions and more.

Example of a multi page crawl with valid instance up using a11ywatch_cli v0.8.23:

demo.mp4

For a step by step view the docs.

Docker

You can also get started using the standlone docker image locally or self host it.

With a valid docker installation up in a new folder run the following command (replace latest with darwin on macOS or use the IMAGE env var):

# create the bridge network for front-end and backend
docker network create --driver bridge a11ywatch-net
# start the backend
docker run -p 3280:3280 -v ${PWD}:/a11ywatch/conf \
  --network a11ywatch-net \
  --name a11ywatch-backend \
  -e SUPER_MODE=true \
  a11ywatch/a11ywatch:${IMAGE:-latest}
# start the frontend
docker run -p 3000:3000 -v ${PWD}:/a11ywatch/conf \
  --network a11ywatch-net \
  --name a11ywatch-frontend \
  -e SUPER_MODE=true \
  a11ywatch/web

Afterwards open http://localhost:3000 in your browser to continue.

Example of the dashboard crawling multi websites with live updates:

video_crawl.1.mp4

For step by step instructions, view the docs.

Sidecar

If you want to integrate your system with A11yWatch the simplest way is to use the javascript sidecar. The sidecar provides utility methods and launches the system locally for integration with nodejs.

Development

View the contributing docs to get started.

Benchmarks below are done on a Apple M1 Max 64gb memory.

Local (no latency)

Case: https://a11ywatch.com multi site scan. 10x simultaneous runs each ran via localhost to avoid latency.

libraries
Rust[A11yWatch]: crawl 10 times against 30 urls 10 ms
Nodejs[Pa11y-Wave]: crawl 10 times against 25 urls 63 s
Nodejs[Axe-Deque]: crawl 10 times against 25 urls 113 s

External (latency)

Benchmarks using the CLI and hyperfine with network latency.

Single page scan:

hyperfine 'a11ywatch scan -u https://a11ywatch.com' 

Benchmark 1: a11ywatch scan -u https://a11ywatch.com
  Time (mean ± σ):     109.44 ms ±  10 ms    [User: 1.9 ms, System: 2.8 ms]
  Range (min … max):   98.35 ms … 154.3 ms    11 runs

Multi page scan (30 pages):

hyperfine 'a11ywatch crawl -u https://a11ywatch.com' 

Benchmark 1: a11ywatch crawl -u https://a11ywatch.com
  Time (mean ± σ):      0.6715 s ±  0.026 s    [User: 0.003 s, System: 0.003 s]
  Range (min … max):    0.6355 s …  0.714 s    10 runs

A11yWatch helps builds confidence due to handling dynamic parameters and amount of coverage from reports. The system can handle up to 1 million pages under 1 min with 8gb of memory on linux without a sweat.

Some examples on how to integrate with the system. Learn how to use the react-a11ywatch-js hooks and components lib to build custom products or tools.

Support

If you need support, start with the troubleshooting guide, if you still need help please contact us contact.

LICENSE

Check the license file in the root of the project.

kayle's People

Contributors

j-mendez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

shritt

kayle's Issues

Ace score handling

Now that we have ace as a runner, we need to map the errors to the scoremap.

Missing Japanese Translations [Fast_Htmlcs]

The following codes have missing 'ja' translations.

WCAG2AA.Principle1.Guideline1_3.1_3_4.
WCAG2AA.Principle1.Guideline1_4.1_4_10.C32,C31,C33,C38,SCR34,G206
WCAG2AA.Principle1.Guideline1_4.1_4_11.G195,G207,G18,G145,G174,F78
WCAG2AA.Principle1.Guideline1_4.1_4_12.C36,C35
WCAG2AA.Principle1.Guideline1_4.1_4_13.F95
WCAG2AA.Principle2.Guideline2_1.2_1_4.
WCAG2AA.Principle2.Guideline2_5.2_5_1.
WCAG2AA.Principle2.Guideline2_5.2_5_2.
WCAG2AA.Principle2.Guideline2_5.2_5_3.F96
WCAG2AA.Principle2.Guideline2_5.2_5_4.
WCAG2AA.Principle4.Guideline4_1.4_1_3.
WCAG2AA.Principle1.Guideline1_3.1_3_5.H98

Domain name extraction seems incorrect

I'm not totally sure what the intended output is here, but i'm pretty sure the last branch of this code always panics.

if b.len() > 2 {
b[1]
} else if b.len() == 2 {
b[0]
} else {
b[b.len() - 2]
}

If I follow b.len() through here:

  1. if b.len() > 2 is false, then this must be true b.len() <= 2
  2. if b.len() == 2 is false, then this must be true b.len() < 2
  3. to get here, b.len() (given its a usize) is either 0 or 1, so the index used here will I suppose have underflowed(?) and so the b[b.len() - 2] is guaranteed to panic

Since 0.4.72 I am getting a panic in the radiant_blast function through wasm, its not a super useful error but given that it started breaking after this code was introduced I am assuming this is the problem. (The url I am running against in this instance is http://localhost:4173 if it helps)

Edit: I got much nicer error out when running on github actions for some reason, it was just saying RuntimeError: unreachable on my mac:

panicked at 'index out of bounds: the len is 1 but the index is 4294967295', src/lib.rs:29:17

This error pretty much confirms the above

Layout Rendering [Rust Kayle Innate]

In order to get the clip position we need to render our layout with our custom tree. The rust lib taffy can re-create the entire tree with minimal work as long as we bind the css correctly.

Runner 'axe' returns invalid CSS selector starting with '>'

When running a11ywatch with [email protected] and runner 'axe' to analyze https://www.vilhelmina.se, among other the following issue gets reported:

    {
        "code": "meta-viewport-large",
        "type": "error",
        "typeCode": 1,
        "message": "Users should be able to zoom and scale the text up to 500%",
        "context": "<meta name=\"viewport\" content=\"width=device-width,  initial-scale=1.0, maximum-scale=2.0, user-scalable=yes\">",
        "selector": ">:nth-child(1)>:nth-child(3)",
        "runner": "axe",
        "recurrence": 0
      }

The selector starts with > which is AFAIK invalid. It may be the case that simply html is missing at the beginning, given that the context is about a meta tag, probably located inside head, but it should not be the user's task to guess here and correct invalid output.

Remove ACE

Ace is way too slow and the impact for a re-write does not benefit the library since the runner was more for users who are used to using it. We added it failry quickly to test/experiment but, it has done more harm in production than good since theres not a label ( this is really slow and not ideal for large processing, since slow is usually tied to expense ).

Add ignore background-gradients Htmlcs

Htmlcs does not have capabilities of testing gradients. Right now it would be good to ignore this and move the issue as a warning for manual testing.

How to Test a linear gradient?

In order to test a linear gradient we need to take the colors at the point of axis and apply contrast testing against the text.
The text needs to be part of the group in order to test so capturing the text width and the x-y points of where the text.
Once we have the points to map to we can apply the color matching across the gradient. We would take the contrasts for each segment and average them in unless one area fails critically ( we would need to gauge how much of the area failed with the text in it). After we have the metrics of the two a score can be done to validate the gradient.

Bug[(axe:color-contrast-matches)] changes between runs

The test in autoKayle for the domain a11ywatch.com and some others seem to change randomly on puppeteer for the warning color-contrast. When running autoKayle across the entire domain colorContrastMatches adds extra warnings. This needs further investigation.

page.evaluate: TypeError: Cannot read properties of undefined (reading 'run')

Using a setup similar as described in a11ywatch/a11ywatch#65, I encounter a TypeError when scanning https://www.bolagsverket.se/ using either axe or htmlcs as runner.

The scan is run using the latest Docker container 'a11ywatch'. The container is launched via Podman as follows:

podman run --rm --interactive --add-host chrome:127.0.0.2 -p 3280:3280/tcp -p 50050:50050/tcp -p 50051:50051/tcp -p 50052:50052/tcp -p 50053:50053/tcp -p 50054:50054/tcp -p 9222:9222/tcp docker.io/a11ywatch/a11ywatch

Then, a scan is triggered by the following curl invocation:

curl --max-time 30 --location --request POST http://localhost:3280/api/scan -H 'Accept-Charset: utf-8' --header 'Content-Type: application/json' --data-raw '{ "url": "https://www.bolagsverket.se/", "runners": ["axe"] }'

In the terminal where the container was started (not where curl is running), the following output is generated after the start of curl:

page.evaluate: TypeError: Cannot read properties of undefined (reading 'run')
    at eval (eval at evaluate (:208:30), <anonymous>:1:90)
    at UtilityScript.evaluate (<anonymous>:210:17)
    at UtilityScript.<anonymous> (<anonymous>:1:44)
    at o (/usr/src/app/node_modules/kayle/build/kayle.js:1:354)
    at s (/usr/src/app/node_modules/kayle/build/kayle.js:1:715)
    at async g (/usr/src/app/node_modules/kayle/build/kayle.js:1:1685)

On the curl side, valid JSON output is returned, but no accessibility issue is reported:

{"data":{"domain":"www.bolagsverket.se","url":"https://www.bolagsverket.se/","pageLoadTime":{"duration":0,"durationFormated":"Cached/Extremely Fast"},"lastScanDate":"2023-11-17T09:15:10.162Z","issues":[],"issuesInfo":{"possibleIssuesFixedByCdn":0,"totalIssues":0,"issuesFixedByCdn":0,"errorCount":0,"warningCount":0,"noticeCount":0,"accessScore":0,"issueMeta":{"skipContentIncluded":true}},"online":true},"success":true,"code":200,"message":""}

Duplicate notices not being tracked

Some of the notices are not being tracked for the fast_htmlcs runner.

The notice

'If this image cannot be fully described in a short text alternative, ensure a long text alternative is also available, such as in the body text or through a link.'

[ADD RULE] WCAG 2.2: 2.5.8 Target size

Part of adding the new rules from 2.2.

The 2.5.8 needs to be implemented in fast_axecore and fast_htmlcs.

We have a base rule that iterates the nodes top level for htmlcs. The htmlcs portion should include the logic to check for the elements next to each other to see if the rule fails.

fast_axecore, we do not have as nice of a setup for all top rules. We may need to just add a new rule to go through all nodes.

Being cautious of performance is critical for this rule since it touches all nodes.

'selector' field in JSON report may contain invalid/incomplete CSS selector

First, apologies if I report this issue at the wrong place!

I am running a11ywatch as a container as pulled from hub.docker.com and then issuing request for accessibility scans via carefully crafted HTTP POST requests to http://localhost:3280/api/scan. That is working so far and I get back a JSON document with the scan's results.
However, for some but not all issues reported under 'data' -> 'issues', the 'selector' contains invalid (or incomplete) CSS selectors, which makes locating and further processing of reported issues difficult.

For example, take the following HTML page:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="UTF-8" />
<title>Hello</title>
</head>
<body>
<p>Hello</p>
</body>
</html>

The resulting JSON document for the curl invocation of curl --output output.json --location --request POST http://localhost:3280/api/scan --header 'Content-Type: application/json' --data-raw '{ "url": "http://www.example.com/", "runners": ["htmlcs","axe","custom"] }' (assuming the HTML code above is served from 'www.example.com') is as follows:

{
   "code" : 200,
   "data" : {
      "domain" : "www.example.com",
      "issues" : [
         {
            "code" : "landmark-one-main",
            "context" : "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\"><head>\n<meta charset=\"UTF-8\">\n<t...</html>",
            "message" : "Document should have one main landmark",
            "recurrence" : 0,
            "runner" : "axe",
            "selector" : ">:nth-child(1)>:nth-child(1)",
            "type" : "error",
            "typeCode" : 1
         },
         {
            "code" : "page-has-heading-one",
            "context" : "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\"><head>\n<meta charset=\"UTF-8\">\n<t...</html>",
            "message" : "Page should contain a level-one heading",
            "recurrence" : 0,
            "runner" : "axe",
            "selector" : ">:nth-child(1)>:nth-child(1)",
            "type" : "error",
            "typeCode" : 1
         },
         {
            "code" : "region",
            "context" : "<p>Hello</p>",
            "message" : "All page content should be contained by landmarks",
            "recurrence" : 0,
            "runner" : "axe",
            "selector" : "body>:nth-child(1)",
            "type" : "error",
            "typeCode" : 1
         }
      ],
      "issuesInfo" : {
         "accessScore" : 100,
         "errorCount" : 3,
         "issueMeta" : {
            "skipContentIncluded" : true
         },
         "issuesFixedByCdn" : 0,
         "noticeCount" : 0,
         "possibleIssuesFixedByCdn" : 0,
         "totalIssues" : 3,
         "warningCount" : 0
      },
      "lastScanDate" : "2023-10-03T11:33:17.753Z",
      "online" : true,
      "pageLoadTime" : {
         "duration" : 5,
         "durationFormated" : "Cached/Extremely Fast"
      },
      "url" : "https://www.example.com/"
   },
   "message" : "",
   "success" : true
}

The 'issue' with code 'region' has a valid 'selector' (body>:nth-child(1)), but neither the issues 'page-has-heading-one' nor 'landmark-one-main' have one as those two selectors start with >. This symbol denotes 'child combinator' and the 'parent' of this relation is missing.

Expected output: If a concrete element in the DOM tree can be identified as the culprit, the 'selector' field should unambiguously refer to it. If no such unique element exists, then either 'html', 'body', or 'head' should be stated as selector (whatever fits best for a given issue).

Rust/Wasm accessibility audits

The next step for kayle is to create our own runner in Rust that ports to wasm.

We have a high overview of the stability we can get from runs to build.

There is a method called _audit_not_ready in kayle_innate that has a start to getting a web accessibility parser ready.

How

  1. Build a tree that has direct nodes that can be iterated upon of all element tags.
  2. Build a css model mapper to nodes to reflect styles applied.
  3. Apply the rules per node mapped on the tree.
  4. Get context of issues with localization.

Gains

At a high level the runs should perform between 20-40ms consistently for all audits regardless. The scaling has a high top level so the larger will only affect runs a little. Having the consistency of 20-40ms stable across audits could be a big win if we pick out the important test from htmlcs, axe, and ace` while keeping the performance to the T.

Closing Thoughts

Our rewrite of html is really fast where it might make sense to flip the aspects of focus to increase the throughput of that runner until we get it to 10-20ms on average. The codebase allows for easy transitions to o(1) lookups and oneshot maps.

[ADD RULE] 2.4.11 Focus Appearance

This is a more advanced test that is mainly suited for manual auditing. It is possible how ever to test for the appearance across the major browsers. The most basic way to test the element would be with an anchor that overrides the style using outline none inline.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.