Skip to main content

afrigov is an open-source project. It is not a government website and is not affiliated with any government.

Previewing neutral core Change

afrigov Web toolkit for government

Audit

Scores any web page for accessibility at phone and desktop widths, says what to fix first, and reports how much the page costs to load on a phone. It works on any website, built with afrigov or not.

npx afrigov-audit https://example.gov.ng/

The first run downloads a browser once:

npx playwright install chromium

It needs Node 20 or newer.

What you get

Score 41.5 / 100  (D)
9 problems found. Some people cannot use this page.
1 critical · 4 serious · 3 moderate · 1 minor · checked at phone 375px and desktop 1280px

Top 5 to fix first

1. Pinch zoom is disabled in the viewport meta tag
   critical · 1 element · phone and desktop · WCAG 1.4.4
   Fix: Remove user-scalable=no and maximum-scale from the viewport meta.

2. Form elements must have labels
   serious · 6 elements · phone and desktop · WCAG 1.3.1, 4.1.2
   Fix: Every control gets a visible label tied by for/id.

Each fix links to the afrigov page that shows how to do it right.

What it checks

  • The WCAG rules, with axe-core: WCAG 2.0, 2.1 and 2.2 at levels A and AA, at phone width (375px) and desktop width (1280px). A problem found at both widths counts once.
  • What decides whether a page works on a cheap phone, which axe does not score: the page declares its language, pinch zoom is allowed, there is a skip link, the page has a title, and links and buttons are big enough to tap.
  • Page weight on a phone: what the page downloads, how much is images, and which images are heavier than they need to be, with the size each one needs. Weight is reported for information and does not change the score. Images fixes what it finds.

How the score works

The page starts at 100. Each rule that fails takes points off by how serious it is, multiplied by the number of elements, up to five. One broken template with 300 unlabelled links costs 15 points, not 900, so the other problems stay visible.

How serious Points off
Critical 6
Serious 3
Moderate 1.5
Minor 0.5

Grades: A from 90, B from 75, C from 60, D from 40, and F below.

Options

Option What it does
--all Every problem, not just the top five
--phone, --desktop Check at one width only
--fail-under <n> Exit with an error if the score is below n, to stop a release
--badge <file> Write a badge with the grade and score, as .svg or shields.io .json
--label <text> The text on the left of the badge
--json The full result as JSON, for other tools
--timeout <ms> How long to wait for the page, 30 seconds by default
--no-wcag22 Leave out the WCAG 2.2 rules

Stop a release that makes things worse

In a CI pipeline, fail the build when a page drops below a score:

- run: npx playwright install --with-deps chromium
- run: npx afrigov-audit https://staging.example.gov.ng/apply --fail-under 90

Show the score

--badge writes the grade and score as a small image for a README or a status page. Run it on a schedule and the badge stays current. The use cases show these badges for each rebuild and the real site beside it.

npx afrigov-audit https://example.gov.ng/ --badge badges/home.svg

What it does not do

  • It does not replace a person. Automated checks find about a third of real accessibility problems. A pass with a screen reader, by someone who uses one every day, is still needed.
  • One page per run. Run it on the pages that matter: the home page, the start of a service, a form, a confirmation.
  • No login. It sees the page as a visitor does.
  • It never gets around a block. It loads the page once in a real browser and names itself. If a site refuses it, it says so and stops.

Source, the library and the full list of options: afrigov-audit on GitHub. Package: afrigov-audit on npm.