45 releases

0.0.44 Oct 23, 2023
0.0.43 Oct 22, 2023

#16 in Accessibility

Download history 58/week @ 2023-10-02 684/week @ 2023-10-09 380/week @ 2023-10-16 127/week @ 2023-10-23 92/week @ 2023-10-30 3/week @ 2023-11-13 189/week @ 2023-11-20

284 downloads per month

MIT/Apache

555KB
9K SLoC

accessibility-rs

The Rust web accessibility engine.

// pass in html and css rules prior. If css rules are not passed in internal extraction is performed.
let audit = accessibility_rs::audit(&html, &css_rules);

Features

  1. Accurate web accessibility audits without a headless browser.
  2. Re-creating layout trees to get element positions.
  3. Ideal shapes for audits that scale.
  4. Amazingly Fast audits.

About

This crate is actively being developed. Some of the initial code is set as stubs until the feature is complete. We have two params for the initial audit html and css. The reason we have css set is if coming from a browser you can get all the stylesheets from the dom of external sheets at once. This saves time in re-gathering links later.

Notes

Right now the Layout leaf parsing takes a good chunk of time. Until the parsing is done correctly this will be a crutch in performance and main bottleneck. Removing the Clip handling will drastically shave off time from the runs.


lib.rs:

Audit html to see how it complies with WCAG standards.

Accessibility-RS is a web accessibility engine that can replicate websites without a browser to get complex accessibility reports.

How to use Accessibility-RS

There are a couple of ways to use Accessibility-RS:

  • Audit perform an audit against an html page.
    • audit is used to audit a web page for issues.

Examples

A basic WCAG audit for a website:

use accessibility_rs::{audit, AuditConfig};

fn main() {
    let config = AuditConfig::basic(r###"<html><body><h1>My Title</h1><input type="text" placeholder="Type me"></input><img src="tabby_cat.png"></img></body></html>"###);
    let audit = audit(config);
    println!("{:?}", audit);
}

Dependencies

~12–23MB
~320K SLoC