diff --git a/README.md b/README.md index 3c74804..c3d9991 100644 --- a/README.md +++ b/README.md @@ -69,19 +69,6 @@ did not — the shape of a reverse-navigation wrap. It stops short of judging ordering, because a screen reader legitimately phrases the same element differently depending on which way you arrive at it. -> **macOS 27 note.** Live mode cannot start VoiceOver on macOS 27. The driver -> launches it through a hardcoded path that no longer exists there, and the -> newest release has the same path -> ([guidepup#149](https://github.com/guidepup/guidepup/issues/149)). This is not -> a permissions problem and not fixable here. -> -> The CLI checks for this before launching anything and exits immediately with -> an explanation, rather than timing out and leaving VoiceOver half-started. It -> tests for the missing launcher rather than the OS version, so live mode starts -> working again on its own once the driver adds support — nothing to change here. -> -> `scan` and `audit` use a virtual screen reader and are unaffected. - ### Staying up to date When a newer version is published, the CLI mentions it once a day: @@ -110,18 +97,30 @@ npm update -g screen-reader-cli # get the latest ### Live mode setup (optional — for real screen reader testing) -To use the `live` command with a real screen reader, run the one-time setup: - -```bash -npx @guidepup/setup -``` - -This grants the OS permissions needed for screen reader automation: - -- **macOS**: Enables VoiceOver's AppleScript API and adds your terminal to Accessibility permissions -- **Windows**: Configures NVDA for programmatic control - -You only need to do this once per machine. The `scan` command (virtual mode) works without this step. +The `live` command drives a real screen reader, so the operating system has to +allow it once per machine. `scan` and `audit` use a virtual screen reader and +need none of this. + +**macOS (VoiceOver).** In the terminal app you run `screenreader` from: + +1. Run `npx @guidepup/setup setup`. When VoiceOver Utility opens, tick + **Allow VoiceOver to be controlled with AppleScript** on its General tab. + If it then says it was "unable to configure automation permissions" (it + needs your password for that part), do steps 2 and 3 by hand. +2. **System Settings → Privacy & Security → Accessibility:** add your terminal + app and switch it on. +3. **System Settings → Privacy & Security → Full Disk Access:** add your + terminal app and switch it on, then quit the terminal and open it again. + VoiceOver keeps its settings in a protected folder, and the driver swaps in + its own while it runs. +4. Run `npx @guidepup/setup install voiceover`. It downloads VoiceOver settings + made for your macOS version (about 10 MB). +5. On the first `live` run, macOS asks whether your terminal may control + VoiceOver, Google Chrome for Testing and System Events. Allow each one. + The run does not wait for you, so if it fails with "AppleEvent timed out" + while a prompt is open, allow it and run again. + +**Windows (NVDA).** Run `npx @guidepup/setup setup` once. ## Quick start @@ -373,7 +372,7 @@ screenreader live read --reader nvda screenreader live read --reader voiceover ``` -Requires one-time setup: `npx @guidepup/setup` (see Install section above). +Requires one-time setup: `npx @guidepup/setup setup` (see Install section above). ### `page` — Page navigation diff --git a/docs/DEVLOG.md b/docs/DEVLOG.md index 4711c18..48fd4b3 100644 --- a/docs/DEVLOG.md +++ b/docs/DEVLOG.md @@ -6,6 +6,44 @@ Newest entries first. --- +## 2026-10-16 — 0.12.0: live mode on macOS 27 + +Live mode could not start VoiceOver on macOS 27. Apple removed the +`VoiceOverStarter` program that Guidepup, the screen-reader driver, used to +launch it. Guidepup 0.36 opens `VoiceOver.app` instead on macOS 27 +([guidepup#151](https://github.com/guidepup/guidepup/pull/151)), so this +release moves to it. + +Our own check before live mode starts looked for `VoiceOverStarter` too, so it +would have kept refusing every macOS 27 machine even with the new driver. It +now looks for the launcher Guidepup will actually use, picked by the same rule +Guidepup uses, so the two cannot disagree. + +**Removed: `--start-timeout`.** It never did anything. It was handed to +Guidepup as a setting Guidepup never read, in the old version and the new one. +The problem it was meant to solve, a cold VoiceOver start taking longer than +the driver waited, is fixed in Guidepup itself: it now tries twice and waits +30 seconds each time. A command that still passes the flag gets "unknown +option" and should drop it. + +**The reader now reads the page, not an empty window.** Starting VoiceOver +through `VoiceOver.app` brings VoiceOver to the front, which takes focus from +the browser opened just before it. VoiceOver then walked nothing and every +read came back with 0 announcements. Once the reader is running, the browser +is brought back to the front. Checked on a Mac with macOS 27: `live read` on +`test/fixtures/basic.html` reads all 20 items, from the navigation's links to +the footer. + +**Setup has more steps on a current Mac**, and the README now lists them all: +Full Disk Access for the terminal (VoiceOver's settings live in a protected +folder that the driver swaps its own into), a one-time download of those +settings for the macOS version (`npx @guidepup/setup install voiceover`), and +allowing each "control" prompt on the first run. `@guidepup/setup setup` also +needs `setup` after it; without it, it prints its help and changes nothing, +which is what the README used to say to run. + +--- + ## 2026-10-04 — 0.11.0 Ships `screenreader mcp`: an MCP server so AI coding assistants can scan a diff --git a/package-lock.json b/package-lock.json index 471357d..e46b673 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,21 +1,22 @@ { "name": "screen-reader-cli", - "version": "0.11.0", + "version": "0.12.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "screen-reader-cli", - "version": "0.11.0", + "version": "0.12.0", "license": "MIT", "dependencies": { - "@guidepup/guidepup": "^0.24.1", + "@guidepup/guidepup": "^0.36.3", "@guidepup/virtual-screen-reader": "^0.33.0", "axe-core": "^4.11.2", "commander": "^13.0.0", "playwright": "^1.52.0" }, "bin": { + "screen-reader-cli": "bin/cli.js", "screenreader": "bin/cli.js", "sr": "bin/sr.js" }, @@ -56,14 +57,14 @@ } }, "node_modules/@guidepup/guidepup": { - "version": "0.24.1", - "resolved": "https://registry.npmjs.org/@guidepup/guidepup/-/guidepup-0.24.1.tgz", - "integrity": "sha512-L33QKSzeceTOq/DaxAhEkM6fEbJmzkOF2K0U6AsN0zuzy1T4/2LVsLG9f9IPge70T6XgUF7fsCzYotVo4FNk/A==", + "version": "0.36.3", + "resolved": "https://registry.npmjs.org/@guidepup/guidepup/-/guidepup-0.36.3.tgz", + "integrity": "sha512-AurkfbuskRejL/VOvILt3KsITGFfsJfqDvDO0psCzCbfMOAr9A5GYPmeYX0/6+nlddpA7D4H9raUCloKZHxs/g==", "license": "MIT", "dependencies": { - "regedit": "5.1.2", - "semver": "^7.3.8", - "shelljs": "^0.8.5" + "dbus-native": "^0.15.1", + "debug": "^4.4.3", + "plist": "^4.0.0" } }, "node_modules/@guidepup/virtual-screen-reader": { @@ -134,6 +135,15 @@ "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==", "license": "MIT" }, + "node_modules/@xmldom/xmldom": { + "version": "0.9.12", + "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.9.12.tgz", + "integrity": "sha512-5AXjrcMClTryPe9LgZrygpB1lj7s0S9E0+W+AHaVKAVyHanafK86iPSvG5xHVSp/jC+VH1UXu0TAEmY279xH7A==", + "license": "MIT", + "engines": { + "node": ">=14.6" + } + }, "node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -164,22 +174,6 @@ "node": ">=4" } }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "license": "MIT" - }, - "node_modules/brace-expansion": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz", - "integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==", - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, "node_modules/commander": { "version": "13.1.0", "resolved": "https://registry.npmjs.org/commander/-/commander-13.1.0.tgz", @@ -189,17 +183,20 @@ "node": ">=18" } }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "license": "MIT" - }, - "node_modules/core-util-is": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", - "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", - "license": "MIT" + "node_modules/dbus-native": { + "version": "0.15.2", + "resolved": "https://registry.npmjs.org/dbus-native/-/dbus-native-0.15.2.tgz", + "integrity": "sha512-J1IBi4LmbqrFhroN66Dj1tCCTP6TVbZgUKhWQZf3uS6t93yRWEcRRDjOZV9N6boGRhOp/BOjLliFm9vWu1QZOA==", + "license": "MIT", + "dependencies": { + "xml2js": "^0.6.2" + }, + "bin": { + "dbus-native": "bin/dbus-native.js" + }, + "engines": { + "node": ">=22.12.0" + } }, "node_modules/debug": { "version": "4.4.3", @@ -233,12 +230,6 @@ "integrity": "sha512-vdnCeZD+3wZ+8h8xXL/ZtBlvvoobOFyPzSiIfO6sGOZDqjFx4aLMAjZhl4rawj5xYz3UwP6Tgvyh0iH4IOCVnQ==", "license": "MIT" }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "license": "ISC" - }, "node_modules/fsevents": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", @@ -253,107 +244,12 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/hasown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, "node_modules/html-aria": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/html-aria/-/html-aria-0.5.3.tgz", "integrity": "sha512-2SkCacsjXJu0e6D5vLSHlLs7KEdPZ7pIJqLh9EFedPqrAaywthe7jJWQ+PjEyB7bpmWMMOsBJuV4WlYd9WRiug==", "license": "MIT" }, - "node_modules/if-async": { - "version": "3.7.4", - "resolved": "https://registry.npmjs.org/if-async/-/if-async-3.7.4.tgz", - "integrity": "sha512-BFEH2mZyeF6KZKaKLVPZ0wMjIiWOdjvZ7zbx8ENec0qfZhJwKFbX/4jKM5LTKyJEc/GOqUKiiJ2IFKT9yWrZqA==", - "license": "MIT" - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", - "license": "ISC", - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "license": "ISC" - }, - "node_modules/interpret": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", - "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/is-core-module": { - "version": "2.16.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", - "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", - "license": "MIT", - "dependencies": { - "hasown": "^2.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", - "license": "MIT" - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -369,48 +265,12 @@ "lz-string": "bin/bin.js" } }, - "node_modules/minimatch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", - "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "license": "MIT" }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "license": "ISC", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "license": "MIT" - }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -447,6 +307,19 @@ "node": ">=18" } }, + "node_modules/plist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/plist/-/plist-4.0.0.tgz", + "integrity": "sha512-4dOqNo0Y2NpfSf9q4+zr4bh7pzNWeckIam34Z0KYJhg8qtNNfh59VbD+Yna5SjwcxawVvLKx5w5FtuCijpEF4Q==", + "license": "MIT", + "dependencies": { + "@xmldom/xmldom": "^0.9.10", + "xmlbuilder": "^15.1.1" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/pretty-format": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", @@ -467,137 +340,44 @@ "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", "license": "MIT" }, - "node_modules/rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", - "dependencies": { - "resolve": "^1.1.6" - }, + "node_modules/sax": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.6.1.tgz", + "integrity": "sha512-42tBVwLWnaQvW5zc4HbZrTuWccECCZfBi92FDuwtqxasH+JbPB3/FOKb1m222K42R4WxuxzzMsTswfzgtSu64Q==", + "license": "BlueOak-1.0.0", "engines": { - "node": ">= 0.10" + "node": ">=11.0.0" } }, - "node_modules/regedit": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/regedit/-/regedit-5.1.2.tgz", - "integrity": "sha512-pQpWqO/I40bMNoMO9kTQx3e5iK542kYcB/Z8X3Y7Hcri6ydc4KZ9ByUsEWFkBRMcwo+2irHuNK5s+pMGPr6VPw==", - "license": "MIT", - "dependencies": { - "debug": "^4.1.0", - "if-async": "^3.7.4", - "stream-slicer": "0.0.6", - "through2": "^0.6.3" - } - }, - "node_modules/resolve": { - "version": "1.22.11", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz", - "integrity": "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==", + "node_modules/xml2js": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.6.2.tgz", + "integrity": "sha512-T4rieHaC1EXcES0Kxxj4JWgaUQHDk+qwHcYOCFHfiwKz7tOVPLq7Hjq9dM1WCMhylqMEfP7hMcOIChvotiZegA==", "license": "MIT", "dependencies": { - "is-core-module": "^2.16.1", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/semver": { - "version": "7.7.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", - "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/shelljs": { - "version": "0.8.5", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", - "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", - "license": "BSD-3-Clause", - "dependencies": { - "glob": "^7.0.0", - "interpret": "^1.0.0", - "rechoir": "^0.6.2" - }, - "bin": { - "shjs": "bin/shjs" + "sax": ">=0.6.0", + "xmlbuilder": "~11.0.0" }, "engines": { - "node": ">=4" + "node": ">=4.0.0" } }, - "node_modules/stream-slicer": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/stream-slicer/-/stream-slicer-0.0.6.tgz", - "integrity": "sha512-QsY0LbweYE5L+e+iBQgtkM5WUIf7+kCMA/m2VULv8rEEDDnlDPsPvOHH4nli6uaZOKQEt64u65h0l/eeZo7lCw==", - "license": "MIT" - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "node_modules/xml2js/node_modules/xmlbuilder": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", "license": "MIT", "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/through2": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", - "integrity": "sha512-RkK/CCESdTKQZHdmKICijdKKsCRVHs5KsLZ6pACAmF/1GPUQhonHSXWNERctxEp7RmvjdNbZTL5z9V7nSCXKcg==", - "license": "MIT", - "dependencies": { - "readable-stream": ">=1.0.33-1 <1.1.0-0", - "xtend": ">=4.0.0 <4.1.0-0" + "node": ">=4.0" } }, - "node_modules/through2/node_modules/readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha512-ok1qVCJuRkNmvebYikljxJA/UEsKwLl2nI1OmaqAu4/UE+h0wKCHok4XkL/gvi39OacXvw59RJUOFUkDib2rHg==", - "license": "MIT", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "node_modules/through2/node_modules/string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==", - "license": "MIT" - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "license": "ISC" - }, - "node_modules/xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "node_modules/xmlbuilder": { + "version": "15.1.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz", + "integrity": "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==", "license": "MIT", "engines": { - "node": ">=0.4" + "node": ">=8.0" } } } diff --git a/package.json b/package.json index 581365b..aa928e4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "screen-reader-cli", - "version": "0.11.0", + "version": "0.12.0", "description": "Screen reader testing CLI — scan pages for accessibility violations with axe-core + Virtual Screen Reader, drive real VoiceOver/NVDA, generate regression tests", "type": "module", "bin": { @@ -44,7 +44,7 @@ }, "homepage": "https://github.com/Elizabeth1979/screen-reader-cli#readme", "dependencies": { - "@guidepup/guidepup": "^0.24.1", + "@guidepup/guidepup": "^0.36.3", "@guidepup/virtual-screen-reader": "^0.33.0", "axe-core": "^4.11.2", "commander": "^13.0.0", diff --git a/src/commands/live.js b/src/commands/live.js index 4a3dde6..b5579ef 100644 --- a/src/commands/live.js +++ b/src/commands/live.js @@ -12,12 +12,6 @@ function readerOption(cmd) { .option( "--reader ", "Screen reader to use: voiceover or nvda (auto-detects OS by default)" - ) - .option( - "--start-timeout ", - "How long to wait for the screen reader to finish starting. Guidepup's " + - "own default is 10s, which a cold VoiceOver start regularly exceeds.", - "45000" ); } @@ -216,7 +210,7 @@ export function liveCommand() { : "file://" + path.resolve(url); await page.goto(target, { waitUntil: "domcontentloaded" }); - await bridge.start({ timeout: parseInt(opts.startTimeout, 10) }); + await bridge.start(page); const readerLabel = bridge.readerName === "voiceover" ? "VoiceOver" : "NVDA"; console.log(`${readerLabel} started on: ${target}`); @@ -275,7 +269,7 @@ export function liveCommand() { try { await page.goto(target, { waitUntil: "domcontentloaded" }); await page.waitForTimeout(1000); - await bridge.start({ timeout: parseInt(opts.startTimeout, 10) }); + await bridge.start(page); const readerLabel0 = bridge.readerName === "voiceover" ? "VoiceOver" : "NVDA"; @@ -410,7 +404,7 @@ export function liveCommand() { try { await page.goto(target, { waitUntil: "domcontentloaded" }); await page.waitForTimeout(1000); - await bridge.start({ timeout: parseInt(opts.startTimeout, 10) }); + await bridge.start(page); const entry = await enterWebArea(bridge); reportEntry( diff --git a/src/live-bridge.js b/src/live-bridge.js index b6395f8..d16decb 100644 --- a/src/live-bridge.js +++ b/src/live-bridge.js @@ -31,6 +31,18 @@ export function detectReader() { ); } +// The bundle ID of the Chromium Playwright launches ("Google Chrome for +// Testing"); VoiceOver reads the app macOS has in front. +const PLAYWRIGHT_CHROMIUM_ID = "com.google.chrome.for.testing"; + +async function bringToFront(name, page) { + if (name === "voiceover") { + const gp = await import("@guidepup/guidepup"); + await gp.macOSActivateId(PLAYWRIGHT_CHROMIUM_ID); + } + await page?.bringToFront(); +} + export async function createLiveBridge(readerName) { const name = readerName || detectReader(); const reader = await loadReader(name); @@ -39,24 +51,25 @@ export async function createLiveBridge(readerName) { return { readerName: name, - // Guidepup polls for VoiceOver to come up and gives up after 10s by - // default. That is not enough on a cold start: VoiceOver's own launch takes - // several seconds before it answers AppleScript, and guidepup stores and - // rewrites VoiceOver's settings before it even begins waiting. The timeout - // then fires with "Timed out waiting for VoiceOver to be running" while - // VoiceOver is in fact starting — and it is left running, holding the - // machine, because the failure happened mid-startup. - async start({ timeout = 45000 } = {}) { + // Guidepup owns the wait for the screen reader to come up: since 0.36 it + // tries twice and waits 30s each time, enough for a cold VoiceOver start. + // It takes no limit from the caller, so this passes none. + // + // Starting VoiceOver brings it to the front (on macOS 27 Guidepup opens + // VoiceOver.app), which takes focus from the browser, so the reader would + // walk an empty window. Bring the page's browser back once it is running. + async start(page) { if (!started) { try { - await reader.start({ pollTimeout: timeout }); + await reader.start(); started = true; } catch (err) { // Leaving a half-started screen reader behind takes over the user's // machine with no obvious way back, so always try to put it away. await reader.stop().catch(() => {}); - throw new Error(explainStartFailure(err, timeout)); + throw new Error(explainStartFailure(err)); } + await bringToFront(name, page); } }, @@ -127,39 +140,35 @@ export async function createLiveBridge(readerName) { }; } -/** - * Turn a screen-reader start failure into something actionable. - * - * Guidepup ships per-macOS-version assets and hardcodes a launcher path, so on - * a macOS it does not yet support the failure surfaces as "VoiceOver cannot be - * started", a missing-file error, or a timeout — none of which name the cause. - * That sends people to Accessibility permissions, which are not involved, and - * the upstream issue for it (guidepup/guidepup#149) is specifically about the - * cause being hidden. - * - * So diagnose it here rather than pre-emptively refusing to run: the check is - * advisory, and the day guidepup adds support this code simply stops matching - * and nothing is blocked. - */ -// Guidepup launches VoiceOver through this one hardcoded path. It does not -// exist on macOS 27, where the directory holds only `VoiceOver`. -const VOICE_OVER_STARTER = - "/System/Library/CoreServices/VoiceOver.app/Contents/MacOS/VoiceOverStarter"; +// Guidepup launches VoiceOver one of two ways and picks by Darwin version +// (guidepup/guidepup#151): from Darwin 27 it opens VoiceOver.app, because +// macOS 27 removed the VoiceOverStarter binary it ran before. +const VOICE_OVER_APP = "/System/Library/CoreServices/VoiceOver.app"; +const VOICE_OVER_STARTER = `${VOICE_OVER_APP}/Contents/MacOS/VoiceOverStarter`; + +/** The path Guidepup will launch VoiceOver through on this Darwin release. */ +export function voiceOverLauncher(release = os.release()) { + return Number(release.split(".", 1)[0]) >= 27 + ? VOICE_OVER_APP + : VOICE_OVER_STARTER; +} + +const STILL_WORKS = + `What still works — neither needs a real screen reader:\n` + + ` screenreader scan accessibility checks + page structure\n` + + ` screenreader audit full traversal with the virtual screen reader`; /** * Decide whether live mode can work, BEFORE launching a browser or touching the * screen reader. * - * Without this the user waits out a 45-second timeout, VoiceOver may be left - * half-started holding their machine, and the error reads as a permissions - * problem — which is how an hour goes to Accessibility settings that are not - * involved. A check costing one stat call turns that into an immediate, honest - * refusal. + * Without this, a failed start can leave VoiceOver half-started holding the + * machine, and the error reads as a permissions problem — which is how an hour + * goes to Accessibility settings that are not involved. One stat call turns + * that into an immediate, honest refusal. * - * It tests the condition, not the OS version. A version check would go stale - * the moment guidepup adds support or Apple moves the path again, and would - * then block a machine that works. Checking for the launcher itself means this - * resolves on its own. + * It checks for the launcher Guidepup will actually use, by the same rule + * Guidepup uses to choose it, so the two cannot disagree. */ export function preflightLiveMode({ platform = process.platform, @@ -167,25 +176,28 @@ export function preflightLiveMode({ exists = (p) => fs.existsSync(p), } = {}) { if (platform !== "darwin") return { ok: true }; - if (exists(VOICE_OVER_STARTER)) return { ok: true }; + const launcher = voiceOverLauncher(release); + if (exists(launcher)) return { ok: true }; return { ok: false, reason: `Live mode cannot start VoiceOver on this machine (Darwin ${release}).\n\n` + `This is not a permissions problem. The screen-reader driver launches\n` + `VoiceOver through a path that does not exist here:\n` + - ` ${VOICE_OVER_STARTER}\n\n` + - `It is an upstream gap, already reported, and not fixable from this tool:\n` + - ` https://github.com/guidepup/guidepup/issues/149\n\n` + - `What still works — neither needs a real screen reader:\n` + - ` screenreader scan accessibility checks + page structure\n` + - ` screenreader audit full traversal with the virtual screen reader\n\n` + - `Live mode will start working again on its own once the driver supports\n` + - `this macOS; nothing here needs changing.`, + ` ${launcher}\n\n` + + `Report it with that path: https://github.com/Elizabeth1979/screen-reader-cli/issues\n\n` + + STILL_WORKS, }; } -export function explainStartFailure(err, timeout, env = {}) { +/** + * Turn a screen-reader start failure into something actionable. + * + * On a macOS Guidepup does not support yet, it refuses with "macOS version not + * supported" before touching VoiceOver. Wrapped in "VoiceOver cannot be + * started", that reads as a permissions problem, so name the cause outright. + */ +export function explainStartFailure(err, env = {}) { // Platform and release are injected rather than read directly so the // diagnosis is testable on any host. Without this the tests only exercise // this branch on a Mac, and CI — which runs on Linux — silently covers @@ -193,27 +205,21 @@ export function explainStartFailure(err, timeout, env = {}) { const platform = env.platform ?? process.platform; const release = env.release ?? os.release(); const raw = [err?.message, err?.cause?.message].filter(Boolean).join(" — "); - const unsupported = - /VoiceOverStarter|no such file|not supported|manifest|no manifest asset/i.test( - raw, - ); + const unsupported = /not supported|no such file|VoiceOverStarter/i.test(raw); if (platform === "darwin" && unsupported) { - // Deliberately no Darwin-to-macOS conversion: the old offset (Darwin 23 = - // macOS 14) stopped holding when Apple moved to year-based versions, so a - // computed number here would be confidently wrong. Print what was measured. + // Deliberately no Darwin-to-macOS conversion: the offset changed when Apple + // moved to year-based versions, so a computed number could be confidently + // wrong. Print what was measured. return ( `${raw}\n\n` + - `This is almost certainly an unsupported macOS, not a permissions problem.\n` + - `Guidepup ships per-version assets and hardcodes VoiceOver's launcher path;\n` + - `this machine reports Darwin ${release}.\n` + - `Confirm with: npx @guidepup/setup install voiceover\n` + - `Upstream issue: https://github.com/guidepup/guidepup/issues/149\n` + - `Everything except live mode still works — scan and audit need no screen reader.` + `This is an unsupported macOS, not a permissions problem: the screen-reader\n` + + `driver (Guidepup) has no support for Darwin ${release} yet. A newer\n` + + `screen-reader-cli may have it.\n\n` + + STILL_WORKS ); } return ( - `${raw}. The screen reader did not finish starting within ${timeout}ms. ` + - `Check that automation is permitted (npx @guidepup/setup setup), ` + - `or raise the limit with --start-timeout.` + `${raw}. The screen reader did not finish starting. ` + + `Check that automation is permitted (npx @guidepup/setup setup).` ); } diff --git a/test/live.test.js b/test/live.test.js index 464e16d..1f705fd 100644 --- a/test/live.test.js +++ b/test/live.test.js @@ -260,39 +260,38 @@ describe("compareDirections", () => { describe("explainStartFailure", () => { it("names an unsupported macOS rather than sending people to permissions", async () => { - // The upstream complaint (guidepup/guidepup#149) is that the real cause is - // buried, so the first hour goes to Accessibility settings that are not - // involved. The message has to say so outright. + // Guidepup refuses a macOS it has no assets for with "macOS version not + // supported", wrapped in "VoiceOver cannot be started". Read plainly, that + // sends the first hour to Accessibility settings that are not involved, so + // the message has to name the cause outright. const { explainStartFailure } = await import("../src/live-bridge.js"); - const msg = explainStartFailure( - new Error("VoiceOver cannot be started\nCommand failed: .../VoiceOverStarter: No such file or directory"), - 45000, - { platform: "darwin", release: "27.0.0" }, - ); + const err = new Error("VoiceOver cannot be started"); + err.cause = new Error("macOS version not supported: 28"); + const msg = explainStartFailure(err, { platform: "darwin", release: "28.0.0" }); assert.match(msg, /not a permissions problem/i); - assert.match(msg, /guidepup\/issues\/149/); - assert.match(msg, /scan and audit need no screen reader/i); + assert.match(msg, /Darwin 28\.0\.0/); + assert.match(msg, /scan|audit/i, "must say what still works"); }); - it("also catches the newer manifest wording", async () => { + it("still catches a missing launcher binary", async () => { const { explainStartFailure } = await import("../src/live-bridge.js"); - const err = new Error("VoiceOver cannot be started"); - err.cause = new Error("macOS version not supported"); - assert.match( - explainStartFailure(err, 45000, { platform: "darwin", release: "27.0.0" }), - /not a permissions problem/i, + const msg = explainStartFailure( + new Error("VoiceOver cannot be started\nCommand failed: .../VoiceOverStarter: No such file or directory"), + { platform: "darwin", release: "27.0.0" }, ); + assert.match(msg, /not a permissions problem/i); }); - it("leaves an ordinary timeout as a timeout", async () => { + it("leaves an ordinary timeout as a timeout, pointing at setup", async () => { const { explainStartFailure } = await import("../src/live-bridge.js"); const msg = explainStartFailure( new Error("Timed out waiting for VoiceOver to be running"), - 45000, { platform: "darwin", release: "27.0.0" }, ); - assert.match(msg, /--start-timeout/); + assert.match(msg, /@guidepup\/setup/); assert.doesNotMatch(msg, /not a permissions problem/i); + // The old advice named --start-timeout, which never reached Guidepup. + assert.doesNotMatch(msg, /start-timeout/); }); }); @@ -304,28 +303,51 @@ describe("explainStartFailure — platform", () => { const { explainStartFailure } = await import("../src/live-bridge.js"); const msg = explainStartFailure( new Error("VoiceOver cannot be started\nCommand failed: .../VoiceOverStarter: No such file or directory"), - 45000, { platform: "linux", release: "6.1.0" }, ); assert.doesNotMatch(msg, /not a permissions problem/i); }); }); +describe("voiceOverLauncher — the same rule Guidepup uses", () => { + it("opens VoiceOver.app from Darwin 27, where VoiceOverStarter is gone", async () => { + const { voiceOverLauncher } = await import("../src/live-bridge.js"); + assert.equal(voiceOverLauncher("27.0.0"), "/System/Library/CoreServices/VoiceOver.app"); + assert.equal(voiceOverLauncher("28.1.0"), "/System/Library/CoreServices/VoiceOver.app"); + }); + + it("runs VoiceOverStarter before Darwin 27", async () => { + const { voiceOverLauncher } = await import("../src/live-bridge.js"); + assert.match(voiceOverLauncher("25.4.0"), /Contents\/MacOS\/VoiceOverStarter$/); + }); +}); + describe("preflightLiveMode — check before taking over the machine", () => { - it("passes when the launcher VoiceOver needs is present", async () => { + it("passes on macOS 27 when VoiceOver.app is there", async () => { + // Before Guidepup 0.36 this machine was refused: the check looked for + // VoiceOverStarter, which macOS 27 removed, so live mode could never run. + const { preflightLiveMode } = await import("../src/live-bridge.js"); + const checked = []; + const r = preflightLiveMode({ + platform: "darwin", + release: "27.0.0", + exists: (p) => (checked.push(p), p === "/System/Library/CoreServices/VoiceOver.app"), + }); + assert.equal(r.ok, true); + assert.deepEqual(checked, ["/System/Library/CoreServices/VoiceOver.app"]); + }); + + it("checks VoiceOverStarter on an older macOS", async () => { const { preflightLiveMode } = await import("../src/live-bridge.js"); const r = preflightLiveMode({ platform: "darwin", release: "24.0.0", - exists: () => true, + exists: (p) => p.endsWith("/VoiceOverStarter"), }); assert.equal(r.ok, true); }); it("fails fast when the launcher is missing, before anything starts", async () => { - // The condition is checked, not the OS version: when the platform or the - // library changes, this resolves itself instead of blocking on a hardcoded - // version that has gone stale. const { preflightLiveMode } = await import("../src/live-bridge.js"); const r = preflightLiveMode({ platform: "darwin", @@ -334,7 +356,7 @@ describe("preflightLiveMode — check before taking over the machine", () => { }); assert.equal(r.ok, false); assert.match(r.reason, /not a permissions problem/i); - assert.match(r.reason, /issues\/149/); + assert.match(r.reason, /VoiceOver\.app/, "must name the path it looked for"); assert.match(r.reason, /scan|audit/i, "must say what still works"); });