# VoiceOver ARIA Landmark Audit in Safari Guide

Canonical: https://figment.so/blog/mac-voiceover-safari-aria-audit

Drive VoiceOver with osascript through Safari's landmarks, save each announcement to a TSV, and compare it with your expectations to get a pass/fail CSV. Run it on one pinned macOS version, for example a Figment Mac VM.

**Short answer:** run an `osascript` loop that moves the VoiceOver cursor through the page in Safari, captures `content of cursor` for each stop, writes a TSV, and joins it against an expectations file to produce a WCAG 1.3.1-linked pass/fail CSV. The audit covers the eight [WAI-ARIA 1.2 landmark roles](https://www.w3.org/TR/wai-aria-1.2/#landmark_roles). VoiceOver needs a logged-in desktop session, and its phrasing changes between macOS releases, so run the audit on one pinned Mac and one macOS version.

## Why does Safari announce landmarks differently from Chrome?

VoiceOver reads the accessibility tree that WebKit builds, and WebKit is the engine behind Safari. That makes Safari the reference pairing for VoiceOver audits on macOS.

Chrome on macOS uses a different accessibility bridge, so landmark order, role phrasing and compound names (role plus accessible name) can differ. The WAI-ARIA Authoring Practices Group documents VoiceOver with Safari separately from NVDA and JAWS for that reason. An audit in Chrome alone can ship an announcement order that confuses VoiceOver users on macOS and iOS. Only Safari on a real Mac captures the strings those users hear.

## Which eight landmark roles does the audit cover?

[WAI-ARIA 1.2](https://www.w3.org/TR/wai-aria-1.2/#landmark_roles) defines eight landmark roles. Apple's platform accessibility documentation is at [developer.apple.com/documentation/accessibility](https://developer.apple.com/documentation/accessibility/).

| Role | HTML implicit source | Typical VoiceOver phrasing (Safari) |
|---|---|---|
| `banner` | `<header>` (top-level) | "banner" |
| `navigation` | `<nav>` | "navigation" + accessible name if present |
| `main` | `<main>` | "main" |
| `complementary` | `<aside>` | "complementary" |
| `contentinfo` | `<footer>` (top-level) | "content information" |
| `form` | `<form>` with accessible name | "form" + accessible name |
| `region` | `<section>` with accessible name | accessible name + "region" |
| `search` | `<search>` or `role="search"` | "search" |

Exact phrasing varies between macOS releases. Treat the third column as the expectation you confirm against your pinned baseline, not as a spec guarantee. VoiceOver's Web Rotor (VO + U) lists landmarks; the audit below walks them directly.

## How do I allow VoiceOver to run from a script?

Open VoiceOver Utility once on the target Mac and tick **General → Allow VoiceOver to be controlled with AppleScript**. Without that setting, `tell application "VoiceOver"` calls are refused. Also grant the controlling process Accessibility permission in System Settings → Privacy & Security → Accessibility.

With both in place, you can start and stop VoiceOver from a shell:

```bash
# Start VoiceOver (requires AppleScript control to be allowed in VO Utility)
osascript -e 'tell application "VoiceOver" to activate'

# Let VoiceOver finish initializing before driving the cursor
sleep 2

# ... audit script runs here ...

osascript -e 'tell application "VoiceOver" to quit'
```

VoiceOver cannot run headless. The Mac must be logged in with a visible desktop, so the CI agent has to run as a Launch Agent in the logged-in user session, not as a Launch Daemon.

## What does the audit script look like?

Save the following as `scripts/vo-landmark-audit.applescript`. Before running it unattended, confirm the "next landmark" key binding in VoiceOver Help on your target macOS version. The default rotor or commander shortcut has changed between releases.

```applescript
-- vo-landmark-audit.applescript
-- Usage: osascript vo-landmark-audit.applescript <url> <out.tsv>

on run argv
    set targetURL to item 1 of argv
    set outFile to item 2 of argv

    tell application "Safari"
        activate
        open location targetURL
        delay 3
    end tell

    tell application "VoiceOver" to activate
    delay 2

    set rows to {"index" & tab & "spoken_text"}
    set seen to {}

    repeat with i from 1 to 20
        tell application "VoiceOver"
            try
                set spokenText to (get content of cursor)
            on error
                set spokenText to "(no cursor content)"
            end try
        end tell

        if seen contains spokenText then exit repeat
        set end of seen to spokenText
        set end of rows to (i as string) & tab & spokenText

        -- Advance cursor to next landmark. Verify this key combo in VO Help
        -- for your installed macOS before relying on it in CI.
        tell application "System Events"
            key code 37 using {control down, option down, command down} -- VO+Cmd+L
        end tell
        delay 0.4
    end repeat

    set outContent to ""
    repeat with r in rows
        set outContent to outContent & r & linefeed
    end repeat

    set fileRef to open for access (POSIX file outFile) with write permission
    set eof fileRef to 0
    write outContent to fileRef
    close access fileRef

    tell application "VoiceOver" to quit
    return "Audit written to " & outFile
end run
```

Run it:

```bash
osascript scripts/vo-landmark-audit.applescript \
  "https://your-staging-url.example.com" \
  "/tmp/vo-audit-$(date +%Y%m%d).tsv"
```

Example output:

```
index	spoken_text
1	banner
2	navigation, Main Navigation
3	main, Article content
4	complementary, Related articles
5	content information
```

This is an untested example, not a benchmark. A failed `osascript` call returns non-zero, and your CI step must stop on it instead of recording a pass.

## How do I turn the TSV into a WCAG-linked pass/fail CSV?

Create `audit-expectations.tsv`, which maps an expected spoken substring to a WCAG criterion:

```tsv
expected_contains	wcag_criterion	notes
banner	1.3.1	Top-level header must announce as banner
navigation	1.3.1	nav must announce as navigation
main	1.3.1	Single main landmark required
complementary	1.3.1	aside must map to complementary
content information	1.3.1	footer maps to content information
search	1.3.1	search landmark announced
```

Then join it against the audit:

```python
#!/usr/bin/env python3
# scripts/vo-verdict.py <audit.tsv> <expectations.tsv> <output.csv>
import csv, sys

audit_file, expect_file, out_file = sys.argv[1:4]

with open(audit_file) as f:
    audit_rows = list(csv.DictReader(f, delimiter='\t'))

with open(expect_file) as f:
    expectations = list(csv.DictReader(f, delimiter='\t'))

results = []
for exp in expectations:
    keyword = exp['expected_contains'].lower()
    matches = [r for r in audit_rows if keyword in r['spoken_text'].lower()]
    results.append({
        'criterion': exp['wcag_criterion'],
        'expected_contains': exp['expected_contains'],
        'actual_spoken': matches[0]['spoken_text'] if matches else '(not found)',
        'verdict': 'PASS' if matches else 'FAIL',
        'notes': exp['notes'],
    })

with open(out_file, 'w', newline='') as f:
    writer = csv.DictWriter(f, fieldnames=list(results[0].keys()))
    writer.writeheader()
    writer.writerows(results)

failures = [r for r in results if r['verdict'] == 'FAIL']
print(f"Audit complete: {len(results) - len(failures)} PASS, {len(failures)} FAIL")
sys.exit(1 if failures else 0)
```

The CSV is your evidence file: one row per landmark requirement, with the actual spoken string next to the expected substring.

## How do I run the audit nightly on a pinned Mac?

Run it on a machine that stays on one macOS version until you choose to upgrade, because VoiceOver phrasing drifts between releases. Log in to the desktop once, run the job as a Launch Agent for that user, and drive it over SSH:

```bash
ssh ci@mac-host "osascript ~/project/scripts/vo-landmark-audit.applescript \
  'https://staging.example.com' '/tmp/vo-audit.tsv' && \
  python3 ~/project/scripts/vo-verdict.py \
  /tmp/vo-audit.tsv ~/project/audit-expectations.tsv /tmp/vo-results.csv"

scp ci@mac-host:/tmp/vo-results.csv \
  ./audit-evidence/vo-results-$(date +%Y%m%d).csv
```

The scripts read text from the VoiceOver cursor, not audio. We have not measured VoiceOver audio over a remote desktop session, so use the written output as your evidence and listen on your own device when audio matters.

## Which macOS baseline should your VoiceOver audit Mac run?

Pick the plan whose macOS version matches the one your users are most likely to run, then keep every run on that machine type. The Intel Mac VM ([$25 a month](/mac-hosting#intel-vm)) runs macOS Sequoia and fits a Sequoia baseline. The Apple Silicon Mac VM ([$39 a month, or $6 a day](/mac-hosting#apple-silicon-vm)) fits a baseline on Apple silicon; check the macOS version shown before purchase. Choose the [Dedicated M4 Pro 48 GB](/mac-hosting#dedicated-m4-pro) ($349 a month) if you want a whole Mac that nobody shares.

For comparison, [CloudMac lists a Mac mini M4 (16GB, 256GB)](https://cloudmac.org/pricing) at $99.99 a month, or $999 a year, which is $83.25 a month. Twelve months of the Dedicated M4 Pro 48 GB is $3,228 paid up front, and the Apple Silicon Mac VM is 12 × $39 = $468 (a shared VM, not a whole Mac).

**Related guides:**
- [WebKit Pixel Diff Regression Testing](/blog/mac-webkit-pixel-diff-regression)
- [Keychain Entitlement Permission Testing](/blog/mac-keychain-entitlement-permission-test)
- [GitHub Actions Self-Hosted Runner on Mac](/blog/mac-github-actions-self-hosted-runner)
