Fix Android build: accessibility bridge API mismatch - #137
Conversation
PR #127 landed accessibility_android.cpp with two API mismatches that broke the android-build CI check: 1. View::children() doesn't exist; use child_count() + child_at(i) to iterate children, matching the iOS VoiceOver bridge pattern. 2. View::simulate_click() requires a Point in root coordinates. Walk the parent chain to convert the view's local centre into root coords, same technique accessibility_ios.mm uses for accessibilityFrame. No behaviour change on other platforms (file is guarded by __ANDROID__).
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8640d22896
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| cx += p->bounds().x; | ||
| cy += p->bounds().y; | ||
| } | ||
| target->simulate_click(pulp::view::Point{cx, cy}); |
There was a problem hiding this comment.
Dispatch ACTION_CLICK from root instead of target
simulate_click expects coordinates relative to the view it is called on (it immediately does hit_test(root_pos) from that receiver in core/view/src/view.cpp), but this change computes cx/cy in root coordinates and then calls target->simulate_click(...). For any accessible node that is not at (0,0) in its own local space, the hit test misses and TalkBack click actions become no-ops. This breaks accessibility activation for nested controls on Android; call simulate_click on g_root_view (or convert to target-local coordinates) to preserve behavior.
Useful? React with 👍 / 👎.
simulate_click(root_pos) runs hit_test from 'this'; calling it on 'target' (which isn't at origin) causes the hit test to miss and the TalkBack ACTION_CLICK to silently no-op for nested controls. Compute the target's centre in root coordinates and dispatch via g_root_view instead, preserving root-space hit-testing.
Summary
core/view/platform/android/accessibility_android.cppwith two API mismatches that have brokenandroid-buildon every subsequent PR.#ifdef __ANDROID__).Changes:
root.children()→root.child_count()+root.child_at(i)loop (matches iOS VoiceOver bridge atcore/view/platform/ios/accessibility_ios.mm:105-107).target->simulate_click()→target->simulate_click(Point{cx, cy})wherecx,cyis the view's centre in root coordinates (walks parent chain, same approach asaccessibility_ios.mm:66-74).Test plan
android-buildfailures from runs/24308732734)