feat(ios) Accessibility Deferral Element and additions#598
feat(ios) Accessibility Deferral Element and additions#598RoyalPineapple wants to merge 2 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
72fcecd to
9ce750c
Compare
… 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>
9ce750c to
d3c997d
Compare
|
|
||
| /// Custom content that may be supplied in addition to the deferred content | ||
| var customContent: [Accessibility.CustomContent]? { get set } | ||
| var customContent: [BlueprintUI.Accessibility.CustomContent]? { get set } |
There was a problem hiding this comment.
not sure we need this
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?
| result.merge(with: value) | ||
| } | ||
| } | ||
| needsAccessibilityUpdate = true |
There was a problem hiding this comment.
There are two calls to needsAccessibilityUpdate = true in this function. Could we remove one?
| public var sourceIdentifier: AnyHashable | ||
|
|
||
| /// : A stable identifier used to identify a given update pass through he view hierarchy. Content with matching updateIdentifiers should be combined. | ||
| /// A stable identifier used to identify a given update pass through he view hierarchy. Content with matching updateIdentifiers should be combined. |
There was a problem hiding this comment.
| /// A stable identifier used to identify a given update pass through he view hierarchy. Content with matching updateIdentifiers should be combined. | |
| /// A stable identifier used to identify a given update pass through the view hierarchy. Content with matching updateIdentifiers should be combined. |
|
|
||
| /// Custom content that may be supplied in addition to the deferred content | ||
| var customContent: [Accessibility.CustomContent]? { get set } | ||
| var customContent: [BlueprintUI.Accessibility.CustomContent]? { get set } |
| /// - 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?
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.