CXTDT-552834 – Tile Container – Accessibility
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
9aa026ee94
commit
ba4c27cdc6
@ -108,7 +108,7 @@ open class TileContainerBase<PaddingType: DefaultValuing>: Control where Padding
|
||||
$0.clipsToBounds = true
|
||||
}
|
||||
|
||||
private var containerView = View()
|
||||
internal var containerView = View()
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Public Properties
|
||||
@ -342,9 +342,6 @@ open class TileContainerBase<PaddingType: DefaultValuing>: Control where Padding
|
||||
containerView.isAccessibilityElement = onClickSubscriber != nil
|
||||
containerView.accessibilityHint = "Double tap to open."
|
||||
containerView.accessibilityLabel = nil
|
||||
if let views = accessibilityElements?.compactMap({ $0 as? UIView }), !views.isEmpty {
|
||||
containerView.setAccessibilityLabel(for: views)
|
||||
}
|
||||
}
|
||||
|
||||
open override var accessibilityElements: [Any]? {
|
||||
@ -358,10 +355,18 @@ open class TileContainerBase<PaddingType: DefaultValuing>: Control where Padding
|
||||
}
|
||||
items.append(containerView)
|
||||
}
|
||||
items.append(contentsOf: contentView.subviews.filter({ $0.isAccessibilityElement == true }))
|
||||
|
||||
let elements = gatherAccessibilityElements(from: contentView)
|
||||
let views = elements.compactMap({ $0 as? UIView })
|
||||
|
||||
//update accessibilityLabel
|
||||
containerView.setAccessibilityLabel(for: views)
|
||||
|
||||
//append all children that are accessible
|
||||
items.append(contentsOf: elements)
|
||||
|
||||
return items
|
||||
}
|
||||
|
||||
set {}
|
||||
}
|
||||
|
||||
|
||||
@ -415,29 +415,37 @@ open class Tilelet: TileContainerBase<Tilelet.Padding> {
|
||||
|
||||
/// Used to update any Accessibility properties.
|
||||
open override var accessibilityElements: [Any]? {
|
||||
|
||||
get {
|
||||
var elements = [Any]()
|
||||
if let superElements = super.accessibilityElements {
|
||||
elements.append(contentsOf: superElements)
|
||||
}
|
||||
var views = [UIView]()
|
||||
|
||||
// grab the available views in order
|
||||
if badgeModel != nil {
|
||||
elements.append(badge)
|
||||
views.append(badge)
|
||||
}
|
||||
|
||||
if titleModel != nil || subTitleModel != nil || eyebrowModel != nil {
|
||||
elements.append(titleLockup)
|
||||
views.append(titleLockup)
|
||||
}
|
||||
if descriptiveIconModel != nil {
|
||||
elements.append(descriptiveIcon)
|
||||
|
||||
containerView.setAccessibilityLabel(for: views)
|
||||
|
||||
// get the views to return
|
||||
var items = [Any]()
|
||||
if containerView.isAccessibilityElement {
|
||||
if !accessibilityTraits.contains(.button) && !accessibilityTraits.contains(.link) {
|
||||
containerView.accessibilityTraits = .button
|
||||
} else {
|
||||
containerView.accessibilityTraits = accessibilityTraits
|
||||
}
|
||||
items.append(containerView)
|
||||
}
|
||||
if directionalIconModel != nil {
|
||||
elements.append(directionalIcon)
|
||||
}
|
||||
return elements
|
||||
|
||||
//append all other accessible views to traverse
|
||||
items.append(contentsOf: views)
|
||||
|
||||
return items
|
||||
}
|
||||
|
||||
set {}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
|
||||
@ -50,4 +50,16 @@ extension UIView {
|
||||
return isIntersecting
|
||||
}
|
||||
|
||||
public func gatherAccessibilityElements(from view: UIView) -> [Any] {
|
||||
var elements: [Any] = []
|
||||
|
||||
for subview in view.subviews {
|
||||
if subview.isAccessibilityElement && subview.isVisibleOnScreen {
|
||||
elements.append(subview)
|
||||
}
|
||||
elements.append(contentsOf: gatherAccessibilityElements(from: subview))
|
||||
}
|
||||
|
||||
return elements
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
- CXTDT-563189 - Dropdown Select Readonly Border color
|
||||
- CXTDT-555854 - Dropdown Select - spacing issues
|
||||
- CXTDT-563194 - Dropdown Select - missing transparentBackground option
|
||||
- CXTDT-552834 – TileContainer – Voice over is not rendering the information.
|
||||
|
||||
1.0.64
|
||||
----------------
|
||||
|
||||
Loading…
Reference in New Issue
Block a user