Skip to content

fix(tap): Detect switch-like controls for coordinate taps - #67

Open
BariBariGood wants to merge 2 commits into
cameroncooke:mainfrom
BariBariGood:fix/coordinate-tap-toggles
Open

fix(tap): Detect switch-like controls for coordinate taps#67
BariBariGood wants to merge 2 commits into
cameroncooke:mainfrom
BariBariGood:fix/coordinate-tap-toggles

Conversation

@BariBariGood

Copy link
Copy Markdown

Summary

  • Coordinate taps (tap -x/-y) with the default automatic tap style always used the simulator tapAt event, which SwiftUI Toggle controls ignore — the tap printed "✓ Tap ... completed successfully" while the toggle never changed state; only --tap-style physical worked.
  • Selector taps already resolve the target element and switch to physical touch for switch-like controls (fix(tap): Support switch toggle activation #46), so the two tap paths behaved inconsistently for the same control.
  • With automatic style, coordinate taps now look up the accessibility element at the requested point and use physical touch when it reports a switch-like role. Explicit --tap-style simulator and --tap-style physical are unchanged, and if the point lookup fails the tap falls back to the simulator event as before. Batch coordinate taps get the same handling.
  • Adds an Unreleased changelog entry and updates the bundled skill docs.

Validation

  • swift test passes (adds decoding tests for single-element point-lookup payloads).
  • Verified on an iPhone 17 / iOS 26.5 simulator with the AxePlayground switch-test screen: on v1.8.0, tap -x/-y at the SwiftUI toggle's centre reports success while the value stays Off; with this change the same tap flips it to On. --tap-style simulator and --tap-style physical behave as before.

Notes

UIKit UISwitch internals report as plain groups at the tapped point, so coordinate taps on a UISwitch still need --tap-style physical or a selector tap; this limitation is documented in the changelog entry and skill docs.

Coordinate taps (tap -x/-y) with the default automatic tap style always
used the simulator tapAt event, which SwiftUI Toggle and UIKit UISwitch
controls ignore. The tap printed a success message while the toggle
never changed state; only --tap-style physical worked.

Selector taps already resolve the target element and switch to physical
touch for switch-like controls. Extend the same behavior to coordinate
taps: when the style is automatic, look up the accessibility element at
the requested point and use physical touch if it is a switch-like
control. Explicit --tap-style simulator and --tap-style physical are
unchanged, and if the point lookup fails the tap falls back to the
simulator event as before. Batch coordinate taps get the same handling.
Point lookup only sees the accessibility role that the element exposes
at the tapped coordinate. SwiftUI Toggle reports a switch role there,
but UISwitch internals report as plain groups, so coordinate taps on a
UISwitch still need --tap-style physical or a selector tap. Say so in
the changelog entry and skill docs instead of implying both are
covered.
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: eca8b0f6-3eb6-430b-a791-909e2a40e27f

📥 Commits

Reviewing files that changed from the base of the PR and between 30f4bfa and 4e4fe65.

📒 Files selected for processing (7)
  • CHANGELOG.md
  • Skills/CLI/axe/SKILL.md
  • Sources/AXe/Commands/Tap.swift
  • Sources/AXe/Resources/skills/axe/SKILL.md
  • Sources/AXe/Utilities/AccessibilityFetcher.swift
  • Sources/AXe/Utilities/Batch/Command+BatchConvertible.swift
  • Tests/AccessibilityFetcherTests.swift

Walkthrough

Coordinate taps now resolve through accessibility inspection when tap style is automatic. Switch-like elements use physical touch, while inspection failures use simulator tapping. Explicit tap styles bypass inspection. Accessibility data decoding accepts one object or a singleton array. Batch coordinate taps use the new resolver. Tests cover decoding and switch detection. CLI guidance and the changelog document the updated behaviour and UIKit UISwitch limitation.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: detecting switch-like controls for coordinate taps.
Description check ✅ Passed The description directly explains the coordinate-tap fix, retained behaviour, tests, documentation updates, and known limitation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

@4Liberty

Copy link
Copy Markdown

Independent reproduction on AXe 1.8.0 with Xcode 26.6 (17F113) and an iOS 26.5 Simulator:

  • axe tap -x 340 -y 509 --tap-style simulator ... exited 0 and printed success, but the SwiftUI Toggle accessibility state remained Toggle state: disabled.
  • Relaunching the same isolated harness and using --tap-style physical at the same point exited 0 and changed the semantic state to Toggle state: enabled.

This also affects callers that pre-resolve semantic refs into coordinate tap steps (including batch callers). A post-action accessibility assertion was necessary to distinguish the no-op from actual delivery. No desktop capture was used.

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.

2 participants