Extend AX-opaque exemption to web browsers - #104
Merged
Conversation
Web content is routinely invisible to Accessibility — Chromium builds its tree lazily (the first query resolves only a bare AXWebArea), and contenteditable composers like ChatGPT's expose no editable role even with the tree live — so the pre-paste editability gate read real browser text fields as non-editable and degraded dictations to copy-only. Extend the AX-opaque exemption that already covered Electron editors to known browsers (matched by bundle-identifier prefix, covering channel variants): FocusCapture.isAXOpaqueApp = isElectronApp || isBrowserApp now backs KeyInjector's isAXOpaqueEditor seam. The accepted trade-off is a rare beep when a browser truly has nothing editable focused, instead of dropping the user's words to the clipboard. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014iyxjKUdUqKdDXzj24opJt
isAXOpaqueApp now tries the bundle-ID prefix check before isElectronApp's FileManager.fileExists probe, skipping synchronous file I/O on the injector actor for the common browser case. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014iyxjKUdUqKdDXzj24opJt
There was a problem hiding this comment.
Pull request overview
Extends the engine’s “AX-opaque app” exemption used by KeyInjector so known web browsers are treated like Electron editors when Accessibility reports no editable focused element, preventing unnecessary copy-only fallback when AX can’t see real web text fields.
Changes:
- Introduces browser bundle-id prefix classification (
FocusCapture.isBrowserBundleID/isBrowserApp) and combines it with Electron detection underFocusCapture.isAXOpaqueApp. - Updates
KeyInjectorto use the broader AX-opaque classification when deciding whether to paste despite missing editable AX signals. - Adds unit tests for browser bundle-id classification and updates existing test comments to reflect the broader category.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/BlurtEngineTests/EditableTargetTests.swift | Updates test commentary to reflect the broader AX-opaque category (Electron editors + browsers). |
| Tests/BlurtEngineTests/BrowserBundleIDTests.swift | Adds unit tests covering browser bundle-id prefix classification. |
| Sources/BlurtEngine/Injection/KeyInjector.swift | Switches injector exemption from Electron-only to AX-opaque apps via FocusCapture.isAXOpaqueApp and updates related docs. |
| Sources/BlurtEngine/FocusCapture/FocusCapture+Editability.swift | Adds browser detection and new isAXOpaqueApp wrapper combining browser + Electron checks. |
| BLURTENGINE.md | Updates public engine documentation to describe the expanded AX-opaque exemption behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The seam now covers web browsers as well as Electron editors, and its default is FocusCapture.isAXOpaqueApp — align the property, initializer label, and test call site with that name. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014iyxjKUdUqKdDXzj24opJt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Web browsers (Safari, Chrome, Firefox, etc.) are accessibility-opaque in practice: Chromium builds its accessibility tree lazily, and
contenteditablecomposers (like ChatGPT's ProseMirror field) surface as generic groups with no settable value. This means "no editable AX signal" in a browser usually indicates "AX can't see the field," not "no field."This PR extends the existing AX-opaque exemption — currently limited to Electron editors (VS Code, Slack) — to include known web browsers. The injector will now paste into browsers even when the focused element exposes no editable AX signal, matching the existing behavior for Electron apps.
Changes:
FocusCapture.isBrowserBundleID()to classify known browsers by bundle identifier prefix (supports stable and channel variants), plus anisBrowserApp()wrapper forNSRunningApplicationFocusCapture.isAXOpaqueApp()combining the browser check with the existingisElectronApp()(which is kept), browser check first to skip the Electron disk probe in the common caseKeyInjector's injectable seam fromisAXOpaqueEditortoisAXOpaqueAppand wire it toFocusCapture.isAXOpaqueAppBLURTENGINE.mdto reflect the broader AX-opaque categoryThe browser list includes Safari, Chrome, Chromium, Edge, Brave, Opera, Vivaldi, Arc, Firefox, DuckDuckGo, and Orion — all matched by prefix to handle beta/dev/canary variants.
How it was tested
scripts/check.sh --portablepasses locally; fullscripts/check.sh(Swift build/tests) runs on CI (macos-26)BLURTENGINE.md)Added
BrowserBundleIDTests(22 cases: 11 stable browser bundle IDs, 5 channel variants, 5 non-browser lookalikes/negatives, 1 nil) pinning the prefix-match classification. ExistingEditableTargetTestscomments updated to reflect the broader AX-opaque category;KeyInjectorInsertTestscovers the paste-on-no-signal path through the renamed seam.https://claude.ai/code/session_014iyxjKUdUqKdDXzj24opJt