CXTDT-552842 - Accessibility - Breadcrumbs - The breadcrumb links are not properly placed within a breadcrumbs region.

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-05-02 11:49:24 -05:00
parent 3f36d8b8c9
commit 99978ead11
2 changed files with 18 additions and 3 deletions

View File

@ -96,7 +96,7 @@ open class BreadcrumbItem: ButtonBase {
/// Used to update any Accessibility properties.
open override func updateAccessibility() {
super.updateAccessibility()
accessibilityLabel = "Breadcrumb \(text ?? "")"
accessibilityLabel = text
}
}

View File

@ -39,6 +39,13 @@ open class Breadcrumbs: View {
}
}
open override var accessibilityElements: [Any]? {
get {
return [containerView, breadcrumbs]
}
set {}
}
/// A callback when the selected item changes. Passes parameters (crumb).
open var onBreadcrumbDidSelect: ((BreadcrumbItem) -> Void)?
@ -73,6 +80,11 @@ open class Breadcrumbs: View {
return collectionView
}()
private let containerView = View().with {
$0.isAccessibilityElement = true
$0.accessibilityLabel = "Breadcrumbs"
}
//--------------------------------------------------
// MARK: - Private Methods
//--------------------------------------------------
@ -106,8 +118,10 @@ open class Breadcrumbs: View {
/// Executed on initialization for this View.
open override func initialSetup() {
super.initialSetup()
addSubview(collectionView)
containerView.addSubview(collectionView)
collectionView.pinToSuperView()
addSubview(containerView)
containerView.pinToSuperView()
}
/// Resets to default settings.
@ -124,7 +138,7 @@ open class Breadcrumbs: View {
super.updateView()
collectionView.reloadData()
}
open override func layoutSubviews() {
//Turn off the ability to execute updateView() in the super
//since we don't want an infinite loop
@ -139,6 +153,7 @@ open class Breadcrumbs: View {
}
}
private var separatorWidth = Label().with { $0.text = "/"; $0.sizeToFit() }.intrinsicContentSize.width
}
extension Breadcrumbs: UICollectionViewDelegate, UICollectionViewDataSource, ButtongGroupPositionLayoutDelegate {