Skip to content

Fix empty accessibility hierarchy on iOS 26+ simulators#312

Open
dpearson2699 wants to merge 1 commit intogetsentry:mainfrom
dpearson2699:fix/290
Open

Fix empty accessibility hierarchy on iOS 26+ simulators#312
dpearson2699 wants to merge 1 commit intogetsentry:mainfrom
dpearson2699:fix/290

Conversation

@dpearson2699
Copy link
Copy Markdown

Summary

On iOS 26+ fresh simulators, AccessibilityEnabled and ApplicationAccessibilityEnabled default to 0, which causes snapshot_ui to return an empty accessibility hierarchy with no children.

This PR proactively enables both accessibility flags at simulator boot time via xcrun simctl spawn <udid> defaults write, so snapshot_ui works correctly on first use.

Changes

  • src/utils/simulator-accessibility.ts — New ensureSimulatorAccessibility() utility that reads the current AccessibilityEnabled value and writes both flags if disabled. Failures are logged but never propagated (accessibility setup should not block boot).
  • src/mcp/tools/simulator/boot_sim.ts — Calls ensureSimulatorAccessibility() after successful boot.
  • src/mcp/tools/simulator/build_run_sim.ts — Calls ensureSimulatorAccessibility() after the boot-if-needed section, covering the implicit boot path.
  • src/utils/__tests__/simulator-accessibility.test.ts — 6 unit tests covering enable, skip-if-already-enabled, error handling, and command verification.
  • src/mcp/tools/simulator/__tests__/boot_sim.test.ts — Updated command verification test to account for accessibility calls after boot.

Design decisions

  • Proactive at boot rather than reactive at snapshot_ui time — avoids the overhead of detecting an empty hierarchy, retrying, and adding response notes.
  • Idempotent — reads first, writes only if needed. Persists until device erasure.
  • Fire-and-forget — errors are caught and logged at warn level, never thrown.

Fixes #290

Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e963be0. Configure here.

)

On iOS 26+ fresh simulators, AccessibilityEnabled and
ApplicationAccessibilityEnabled default to 0, which prevents
accessibility hierarchy queries from returning any elements.

Enable both flags via xcrun simctl spawn defaults write after
boot_sim and build_run_sim boot the simulator. The check is
idempotent (reads first, writes only if needed) and failures
are logged but never propagated to avoid blocking boot.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

describe-ui returns empty hierarchy on iOS 26+ simulators — auto-enable accessibility defaults

1 participant