Surface SwiftUI swipe actions via _privateAccessibilityCustomActions#323
Draft
RoyalPineapple wants to merge 3 commits intomainfrom
Draft
Surface SwiftUI swipe actions via _privateAccessibilityCustomActions#323RoyalPineapple wants to merge 3 commits intomainfrom
RoyalPineapple wants to merge 3 commits intomainfrom
Conversation
63c1660 to
da313dc
Compare
Adds a demo screen exercising SwiftUI .swipeActions with three cases: swipe-only, swipe + public action (same name), and swipe + public action (different names). Snapshot tests and reference images capture the current state where swipe actions are NOT surfaced by the parser. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SwiftUI .swipeActions are exposed through NSObject's private _privateAccessibilityCustomActions, which lives on container views (e.g. ListCollectionViewCell) rather than on individual accessibility elements. Captures these at the container level in AccessibilityContainer.customActions. VoiceOver presents private actions first and does not deduplicate against public actions with the same name — allCustomActions on NSObject now matches this behavior. Container-aware rendering (displaying these in snapshots) is deferred to future work. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
da313dc to
718686a
Compare
…tions The new `!customActions.isEmpty` guard in `containerInfo(for:)` can return a ContainerInfo for .none-typed views that carry private custom actions (e.g. SwiftUI swipe actions). Update the comment and doc to reflect this. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Problem
SwiftUI
.swipeActionsare invisible to the accessibility snapshot parser. VoiceOver surfaces them, but the parser only readsaccessibilityCustomActions— which doesn't include swipe actions.Root cause
UIKit exposes SwiftUI swipe actions through a private API:
_privateAccessibilityCustomActionsonNSObject. These actions live on the container view (e.g.ListCollectionViewCell), not on the accessibility element proxies inside it:The parser walks the proxy elements but never looks at the container — so swipe actions are silently dropped.
Solution
Capture private custom actions at the container level in the accessibility model:
VoiceOver behavior (verified on device)
allCustomActionsonNSObjectmatches this ordering and dedup behavior.What's deferred
Container-aware rendering is future work. The snapshot reference images are identical before and after the parser fix — the model now correctly captures swipe actions, but they won't appear visually in snapshots until the renderer is updated to display container-level actions. Depends on #278 (container visualization) landing first.
Commit structure
99083951Add SwiftUI swipe actions demo and snapshot tests718686a7Read swipe actions via _privateAccessibilityCustomActionsDependencies
Test plan
SwipeActionsParserTests— container captures private actions, element public actions preserved, multi-element row inheritance, no-swipe baseline🤖 Generated with Claude Code