Add container visualization for accessibility snapshots#278
Draft
RoyalPineapple wants to merge 6 commits intomainfrom
Draft
Add container visualization for accessibility snapshots#278RoyalPineapple wants to merge 6 commits intomainfrom
RoyalPineapple wants to merge 6 commits intomainfrom
Conversation
ab737b5 to
b25c3f7
Compare
3d8c515 to
3733a88
Compare
452d709 to
b531faf
Compare
22e4ff1 to
5b522ad
Compare
5102b9b to
7a2587e
Compare
f887155 to
dc8efaa
Compare
RoyalPineapple
commented
Jan 27, 2026
e2c65ec to
bb6609f
Compare
bb6609f to
2635b9f
Compare
3 tasks
2635b9f to
2809649
Compare
drawHierarchy(afterScreenUpdates:true) can trigger safe area layout changes that shift UICollectionView-backed content (e.g. List cells). When parsing happened after rendering, the parser read frames from a different layout state than what the image captured. Fix: parse the accessibility hierarchy before rendering the snapshot image, so drawHierarchy captures the same layout state the parser read. Also updates the test helper to accept a configuration parameter and adds iOS 26.4 to tested device configs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When showContainers is enabled in the configuration, the legend renders a hierarchical view that groups elements by their accessibility containers using dashed borders and container badges. New files: - HierarchyColorAssignment: assigns color indices to hierarchy nodes - ContainerLegendEntryView: dashed-border legend entry with badge - HierarchyLegendView: recursive hierarchical legend renderer - ContainerDemo: demo using SemanticGroupWrapper for real UIKit containers Changes: - AccessibilitySnapshotConfiguration: add showContainers flag - ParsedAccessibilityData: add hierarchy tree (not just flat markers) - SwiftUIAccessibilitySnapshotView: swap legend based on showContainers - SwiftUIAccessibilitySnapshotContainerView: pass hierarchy through The snapshot area (image + overlays) is identical regardless of showContainers — only the legend content changes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5 tasks
5a9399f to
cda7fbe
Compare
drawHierarchyInRect renders content with safe area offsets applied, causing a ~68pt misalignment between overlay positions and rendered content. renderLayerInContext renders the layer tree directly without safe area effects, producing correctly aligned overlays. Also updates HierarchyColorAssignment to use traversal-order-based element indexing so legend colors match overlay colors, and re-records all iOS 26.4 reference images with the corrected rendering mode. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
bacc4d0 to
a0352bf
Compare
Container badges now display the container's label, type, or identifier instead of just a number. Semantic groups show "label: value" when both are present, or just the label/value/identifier individually. Other container types show their type name (List, Landmark, Tab Bar, etc.). 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.
Supersedes previous container visualization attempts on this branch with a clean rebuild from main.
Summary
showContainersconfiguration flag)Details
Overlay alignment fix
drawHierarchy(afterScreenUpdates:true)can trigger safe area layout changes that shiftUICollectionView-backed content. When parsing happened after rendering, the parser read frames from a different layout state than what the image captured. Fix: parse before rendering.Container legend
When
showContainersis enabled, the legend renders a hierarchical view that groups elements by their accessibility containers using dashed borders and container badges. The snapshot area (image + overlays) is identical regardless ofshowContainers— only the legend content changes.New types:
HierarchyColorAssignment— assigns color indices to hierarchy nodesContainerLegendEntryView— dashed-border legend entry with badgeHierarchyLegendView— recursive hierarchical legend rendererDemo includes
SemanticGroupWrapper— a lightweightUIViewRepresentablethat setsaccessibilityContainerType = .semanticGroupsince SwiftUI has no native equivalent.Test plan
drawHierarchyInRectandrenderLayerInContext🤖 Generated with Claude Code