Install
npm install --save-dev @a11ied/compat The results ship inside the package, so a check reads no network and gives the same answer every time. They are the same results the screen reader compatibility tables show: W3C ARIA-AT reports, and test cases a11ied ran.
Check the features you use
checkCompatibility takes a Browserslist query and a list of features.
It returns one diagnostic for each way a feature fails in the browsers you named.
import { checkCompatibility } from '@a11ied/compat';
const report = checkCompatibility({
browserslist: 'last 2 safari versions',
usages: [
'aria-pressed',
'aria-posinset',
{
feature: 'aria-invalid',
element: '<input aria-invalid="true">',
location: { file: 'src/signup.tsx', line: 12, column: 8 },
},
],
});
for (const diagnostic of report.diagnostics) {
const { file, line } = diagnostic.location ?? {};
const where = file ? ` ${file}:${String(line)}` : '';
console.log(`${diagnostic.severity} ${diagnostic.code}${where}`);
console.log(` ${diagnostic.message}`);
}
console.log(`${report.summary.errors} errors, ${report.summary.warnings} warnings`);
process.exitCode = report.summary.hasErrors ? 1 : 0; error a11ied/must-failure
aria:aria-pressed fails RFC 2119 MUST requirements in VoiceOver for macOS 15.0 + Safari 18.6 (macOS 15.0) (+1 more).
error a11ied/severe-side-effect
aria:aria-pressed causes SEVERE screen reader side effects in VoiceOver for macOS 15.0 + Safari 18.6 (macOS 15.0) (+1 more).
warning a11ied/should-failure
aria:aria-posinset fails RFC 2119 SHOULD requirements in VoiceOver for macOS 15.0 + Safari 26 (macOS 15.0) (+1 more).
error a11ied/must-failure src/signup.tsx:12
aria:aria-invalid fails RFC 2119 MUST requirements in VoiceOver for macOS 26 + Safari 26.2 (macOS 26) (+1 more).
3 errors, 1 warnings Each message names the first screen reader, browser, and operating system that fails, and counts the rest. The report has four parts.
diagnostics- The problems found. This is the list a lint rule reports.
results- One entry per feature, with every matched test result. See check one feature.
targets- The browsers the query resolved to.
summary- Counts of errors, warnings, and notes.
hasErrorsis true when there is at least one error, andhasIssueswhen there is an error or a warning.
Ways to name a feature
A feature is a string, or an object when you want the diagnostic to carry a location.
'aria-pressed'- An ARIA attribute.
'role="alert"','aria:alert'- An ARIA role. Both forms mean the same feature.
'@checked','html:@checked'- An HTML attribute.
{ feature, element, location }featureis one of the strings above.elementis the markup, andlocationis afile,line, andcolumn. Both are copied onto the diagnostic unchanged.
A name the data does not have gets the status unknown-feature. Pass
reportUnknownFeatures: true to get a diagnostic for it.
listSupportedFeatures() returns the 60 features
the data covers.
Choose the browsers
browserslist- A query such as
'defaults'or'last 2 versions', or a list of queries. - No
browserslist - The check uses your project's Browserslist configuration, and
defaultswhen it finds none. path,env,config- Where Browserslist looks for that configuration, and which environment in it to use.
Browserslist names browsers, not screen readers, so each browser stands for the screen readers people use with it.
import { resolveBrowserslistTargets } from '@a11ied/compat';
const { targets } = resolveBrowserslistTargets({
browserslist: 'last 1 chrome version, last 1 safari version, last 1 and_chr version',
});
for (const target of targets) {
console.log(`${target.raw}: ${target.expectedScreenReaders.join(', ')}`);
} and_chr 157: TalkBack
chrome 157: JAWS, NVDA, VoiceOver
safari 27.2: VoiceOver | Browserslist name | Browser | Screen readers checked |
|---|---|---|
chrome | Chrome on a desktop | JAWS, NVDA, VoiceOver |
firefox | Firefox on a desktop | NVDA, VoiceOver, JAWS |
safari | Safari on macOS | VoiceOver |
edge | Edge on Windows | JAWS, NVDA |
and_chr, and_ff | Chrome and Firefox on Android | TalkBack |
android | Android WebView | TalkBack |
ios_saf | Safari on iOS | VoiceOver |
These options narrow or widen what is checked.
screenReaders- Check only these, such as
[ 'NVDA', 'JAWS' ]. versionMatching'nearest', the default, uses the closest browser version that was tested.'exact'uses a result only when the tested version matches the target.includeWebViews- Count results recorded in a WebView. On by default.
includeVirtual- Count results from the simulated screen reader. Off by default, because it is not a screen reader anyone uses.
Read the diagnostics
MUST, SHOULD, and MAY are the priorities W3C ARIA-AT gives each check: what a screen reader is required to convey, what it is recommended to, and what it may.
| Code | Severity | Meaning |
|---|---|---|
a11ied/must-failure | error | A MUST check fails. |
a11ied/severe-side-effect | error | The screen reader did something the test did not expect, rated severe. |
a11ied/should-failure | warning | A SHOULD check fails. |
a11ied/moderate-side-effect | warning | The screen reader did something the test did not expect, rated moderate. |
a11ied/may-failure | info | A MAY check fails. Reported only with minPriority: 'MAY'. |
a11ied/untested-target | info | A browser and screen reader pair in your targets has no result. Reported only with reportUntested: true. |
a11ied/unknown-feature | info | The data does not have the feature. Reported only with reportUnknownFeatures: true. |
minPriority sets how far down the list a check goes. The default,
'SHOULD', reports errors and warnings. 'MUST' reports
errors only.
Each diagnostic has these fields.
code,severity,message- What a lint rule or an editor shows.
featureKey- The feature, such as
aria:aria-pressed. location,element- Copied from the usage you passed in.
specURL,docsPath- The feature in its specification, and its page in the compatibility tables.
docsPathis a path under this site. affectedEnvironments- Every failing screen reader, browser, and operating system, each with the checks that failed and any bug filed against the screen reader.
Check one feature
checkFeatureSupport returns the result for one feature without building
diagnostics. Use it to show support in an editor hover or a documentation page.
import { checkFeatureSupport } from '@a11ied/compat';
const result = checkFeatureSupport('aria-pressed', {
browserslist: 'last 1 chrome version, last 1 safari version',
});
console.log(result.status);
for (const match of result.matchedEnvironments) {
const { environment, summary } = match;
console.log(
`${match.target.raw}: ${environment.screenReader} ${environment.screenReaderVersion}`,
`with ${environment.browser} ${environment.browserVersion}`,
`${match.outcome}, MUST ${summary.must.passed}/${summary.must.total}`,
`(${match.matchPrecision})`,
);
}
for (const gap of result.untestedTargets) {
console.log(`${gap.target.raw}: ${gap.screenReader} is untested`);
} unsupported
chrome 157: JAWS 2025.2508.120 with Chrome 143 pass, MUST 50/50 (nearest-older)
chrome 157: NVDA 2023.3.4 with Chrome 123.0.0 fail, MUST 47/50 (nearest-older)
safari 27.2: VoiceOver for macOS 15.0 with Safari 18.6 fail, MUST 28/36 (nearest-older)
chrome 157: VoiceOver is untested statussupported,partial,unsupported,untested, orunknown-feature. One failing pair makes a featureunsupported.matchedEnvironments- One entry for each target and screen reader that has a result: the tested environment, its outcome, the check counts, and the checks that failed.
matchPrecisionexactwhen the tested browser version is the target's.nearest-olderornearest-newerwhen the closest tested version was used.untestedTargets- The target and screen reader pairs with no result, each with the reason.
Query the data
These functions read the results without a Browserslist query.
import {
getFeature,
getTestCaseOutcomes,
listSupportedFeatures,
queryEnvironments,
queryTestCases,
} from '@a11ied/compat';
// Every tracked feature, or only the ones that match.
console.log(listSupportedFeatures().length);
console.log(listSupportedFeatures({ search: 'live' }).map((feature) => feature.key));
// One feature, with every environment it was tested in.
const alert = getFeature('role="alert"');
console.log(alert?.key, alert?.versionedEnvironments.length);
// The screen reader, browser, and operating system combinations with results.
const nvda = queryEnvironments({ screenReader: 'NVDA', status: 'tested' });
console.log(nvda.length);
// The test cases a11ied ran, and what a screen reader said in one of them.
const [ testCase ] = queryTestCases({ attribute: 'aria-live' });
const { runs } = getTestCaseOutcomes(testCase?.slug ?? '');
console.log(testCase?.slug, runs[0]?.outcome, runs[0]?.keyAnnouncement); 60
[ 'aria:aria-live' ]
aria:alert 14
23
aria-live-polite-update fail Save settings button is in the VoiceOver cursor | Save settings button listSupportedFeatures(filter)- The features. Filter by
type('aria'or'html') orsearch. getFeature(name)- One feature with every environment it was tested in.
queryEnvironments(filter)- The tested combinations. Filter by
screenReader,browser,os,status, orsource. queryTestCases(filter)- The test cases a11ied ran. Filter by
attribute,category,tag, orsearch. getTestCaseOutcomes(slug)- Each run of one test case, with its outcome and the transcript of what the screen reader said.
resolveBrowserslistTargets(options)- The browsers a query resolves to, and the screen readers each stands for.
The package exports the type of every value on this page, such as
CompatibilityReport and CompatibilityDiagnostic.