Skip to content

Activate lazy Chromium/Electron accessibility trees for Edit Mode (fixes #237)#265

Open
swimmer-303 wants to merge 1 commit into
zachlatta:mainfrom
swimmer-303:split/electron-editmode
Open

Activate lazy Chromium/Electron accessibility trees for Edit Mode (fixes #237)#265
swimmer-303 wants to merge 1 commit into
zachlatta:mainfrom
swimmer-303:split/electron-editmode

Conversation

@swimmer-303

@swimmer-303 swimmer-303 commented Jul 11, 2026

Copy link
Copy Markdown

Split out from #254.

Chromium-based apps build their accessibility tree lazily, so AXSelectedText reads failed and Edit Mode fell back to dictation — overwriting the user's selection in VS Code, Gmail-in-Chrome, etc. FreeFlow now sets Electron's AXManualAccessibility opt-in on the frontmost app before reading the selection (harmless no-op elsewhere), plus Chromium's AXEnhancedUserInterface for known browsers only (scoped narrowly since that attribute can interact badly with window-manager utilities). The first read after activation gets one 100 ms retry because the tree builds asynchronously.

Fixes #237

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fixed Edit Mode selection handling in VS Code, Gmail in Chrome, and other Electron/Chromium apps.
    • Prevented selected text from being silently replaced by dictation when accessibility data is initially unavailable.
    • Improved context detection by activating accessibility support before reading selected text and window details.

Chromium-based apps expose no AXSelectedText until a client opts in,
so Edit Mode silently fell back to dictation and overwrote selections
in VS Code, Gmail-in-Chrome, and other Electron apps. Set Electron's
AXManualAccessibility on the frontmost app before reading the
selection (harmless where unsupported), plus Chromium's
AXEnhancedUserInterface for known browsers only, since that attribute
can interact badly with window-manager utilities. The first read after
activation gets one 100ms retry because the tree builds asynchronously.

Fixes zachlatta#237

(cherry picked from commit 9bb20c7)
@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a23d23c7-fd8f-4dec-8cd7-3ce42d098101

📥 Commits

Reviewing files that changed from the base of the PR and between 7427ca9 and 1b43d5c.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • Sources/AppContextService.swift

📝 Walkthrough

Walkthrough

FreeFlow now activates the frontmost Chromium or Electron app’s accessibility tree before reading selection context, retries an initially unavailable selection after activation, and documents the Edit Mode fix for affected applications.

Changes

Selection accessibility handling

Layer / File(s) Summary
Chromium and Electron accessibility activation
Sources/AppContextService.swift, CHANGELOG.md
The service tracks activated processes, enables required accessibility attributes for Chromium-derived apps, and documents the Edit Mode fix.
Selection and context capture integration
Sources/AppContextService.swift
Selection and context collection activate accessibility before reading window titles and selected text, retrying once after a brief delay when the first read returns no selection.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the accessibility-tree activation fix for Edit Mode in Chromium/Electron apps.
Linked Issues check ✅ Passed The changes implement lazy accessibility-tree activation and a retry for Electron/Chromium apps, matching #237’s Edit Mode fix.
Out of Scope Changes check ✅ Passed Only the requested Edit Mode fix and a changelog entry are present; no unrelated scope is indicated.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Edit Mode silently falls back to dictation in Electron (VSCode) & Chromium (Gmail) — overwrites selection instead of transforming

1 participant