How it works

This page explains how Accented works under the hood, why it’s designed the way it is, and what its limitations are.

Design principles

Architecture overview

Accented consists of a few core components.

Known limitations

Accented aims to be as helpful and reliable as possible, but it does have limitations.

Performance

Accented is designed to minimize performance impact on the host application, but it still runs on the main thread, and some of its operations may still take hundreds of milliseconds (especially on pages with lots of elements).

The most expensive operation is running axe.run() after a DOM mutation.

To make it as fast as possible, Accented only runs axe.run() on the parts of the page that changed.

Accented provides APIs to help you measure and tune its performance.

Throttling

Calls to axe.run() are throttled, unless you explicitly set wait to 0.

Throttling ensures that if mutations happen frequently in your app, the main thread will still have periods during which the axe-core script is guaranteed not to run. This can help your app stay responsive.

Here’s how it works:

  1. Accented is initialized (accented() is called) or a DOM mutation happens.
  2. If leading is false, Accented does nothing for wait milliseconds. If leading is true, Accented runs a scan immediately.
  3. Axe-core runs its scan, and depending on its findings, Accented may add or remove some outlines and dialog triggers.
  4. Accented waits for wait milliseconds after scanning and page updates are complete.
  5. If there have been other mutations during the scan or the wait time, Accented goes back to step 3.

No matter how many mutations occurred during the previous scan or the wait period, the current scan accounts for all of them. This guarantees that the issues are always up to date, with a maximum delay of the wait time + the scan time.