feat(ios) Accessibility Deferral Element and additions#598
feat(ios) Accessibility Deferral Element and additions#598RoyalPineapple wants to merge 4 commits intomainfrom
Conversation
3511a17 to
9d4dd5b
Compare
fe80b79 to
3eb1400
Compare
80b442d to
025d5b2
Compare
BlueprintUIAccessibilityCore/Sources/AccessibilityComposition.swift
Outdated
Show resolved
Hide resolved
BlueprintUIAccessibilityCore/Sources/AccessibilityComposition.swift
Outdated
Show resolved
Hide resolved
e1e19d9 to
c94d466
Compare
BlueprintUIAccessibilityCore/Sources/AccessibilityDeferral.swift
Outdated
Show resolved
Hide resolved
BlueprintUIAccessibilityCore/Sources/AccessibilityDeferral.swift
Outdated
Show resolved
Hide resolved
BlueprintUIAccessibilityCore/Sources/AccessibilityDeferral.swift
Outdated
Show resolved
Hide resolved
BlueprintUIAccessibilityCore/Sources/AccessibilityComposition.swift
Outdated
Show resolved
Hide resolved
a4cc843 to
ee29332
Compare
|
|
||
| func replaceContent(_ content: [AccessibilityDeferral.Content]?) { | ||
| deferredAccessibilityContent = content | ||
| internal func replaceContent(_ content: [AccessibilityDeferral.Content]?) { |
There was a problem hiding this comment.
moving this internal as it doesn't need to be the responsibility of the consumer and this removes some foot guns
9ce750c to
d3c997d
Compare
BlueprintUIAccessibilityCore/Sources/AccessibilityDeferral.swift
Outdated
Show resolved
Hide resolved
johnnewman-square
left a comment
There was a problem hiding this comment.
These changes look good. I'm going to give the Market integration a pass and will circle back.
I think it would be great if we could add new unit tests for these deferral updates, if possible.
| mergeValues = deferred.dropFirst() | ||
| .reduce(into: first) { result, value in | ||
| result.merge(with: value) | ||
| } |
There was a problem hiding this comment.
Will the result of result.merge(with: value) be discarded here? I wonder if we could tweak this reduce pattern just a bit and add a unit test that captures this particular flow.
|
|
||
| /// Creates a `ReceiverContainer` element to expose the deferred accessibility. | ||
| public func deferredAccessibilityReceiver(identifiers: [AnyHashable]) -> AccessibilityDeferral.ReceiverContainer { | ||
| AccessibilityDeferral.ReceiverContainer(wrapping: { self }) | ||
| } |
There was a problem hiding this comment.
Could we update this function to use or remove the identifiers parameter?
BlueprintUIAccessibilityCore/Sources/AccessibilityDeferral.swift
Outdated
Show resolved
Hide resolved
BlueprintUIAccessibilityCore/Sources/AccessibilityDeferral.swift
Outdated
Show resolved
Hide resolved
BlueprintUIAccessibilityCore/Sources/AccessibilityDeferral.swift
Outdated
Show resolved
Hide resolved
| /// - cornerRadius: The radius for rounded corners | ||
| public static func frame(_ rect: CGRect, cornerRadius: CGFloat = accessibilityCornerRadius) -> Self { | ||
| .init { | ||
| UIBezierPath(roundedRect: rect, cornerRadius: max(0, cornerRadius + accessibilityPathInset)) |
There was a problem hiding this comment.
Can this really be negative?
There was a problem hiding this comment.
yea, the path inset is -2 (this was derived through experimentation we did in market)
… element This introduces comprehensive accessibility deferral improvements: - Add ReceiverContainer element to expose deferred accessibility content - Add FrameProvider to centralize accessibility frame handling - Add merge() method to combine accessibility representations - Apply container frames and corner radius to accessibility paths - Refactor Receiver protocol with updateDeferredAccessibility callback - Make CombinableView extensible and add mergeValues support - Update array extensions to package visibility Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
f5a29e8 to
b16b63d
Compare
- Fix reduce bug in updateDeferredAccessibility where merge results were
discarded (reduce(into:) → reduce() since merge returns a new value)
- Remove unused identifiers parameter from deferredAccessibilityReceiver
- Fix typo in doc comment ("through he" → "through the")
- Simplify customContent type to Accessibility.CustomContent
- Remove redundant needsAccessibilityUpdate invalidation
- Add AccessibilityDeferralTests covering merge chaining, apply/replace
flow, and content generation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
This PR enhances the accessibility deferral system with comprehensive improvements to frame handling and element composition.
Key Changes
AccessibilityDeferral.ReceiverContainerallowing arbitrary elements to receive deferred accessibility content without needing to conform to theAccessibilityDeferral.Receiverprotocol directlymerge()method onCompositeRepresentationto combine accessibility values from multiple sourcesReceiverprotocol withupdateDeferredAccessibility(frameProvider:)callback for frame-aware receiversCombinableViewextensible (changed fromfinalclass) and addsmergeValuesproperty for more flexible accessibility compositionTechnical Details
The
FrameProviderstruct provides a unified API for accessibility frame handling that enables UIView-based frame passthrough without taking a strong reference to the backing view.The
ReceiverContainerwraps any element and handles deferred accessibility application automatically, simplifying the integration of accessibility deferral in complex element hierarchies.