From d66d4d0e26acba3fba6e7a86f3afa0c942224b43 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 16 Oct 2024 08:39:48 -0500 Subject: [PATCH 1/4] removed surface since it isn't used anywhere Signed-off-by: Matt Bruce --- VDS/Components/Tilelet/Tilelet.swift | 2 +- VDS/Extensions/UIColor+VDSColor.swift | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/VDS/Components/Tilelet/Tilelet.swift b/VDS/Components/Tilelet/Tilelet.swift index 2109fad0..7be731a4 100644 --- a/VDS/Components/Tilelet/Tilelet.swift +++ b/VDS/Components/Tilelet/Tilelet.swift @@ -104,7 +104,7 @@ open class Tilelet: TileContainerBase, ParentViewProtocol { } private var backgroundColorSurface: Surface { - backgroundColorConfiguration.getColor(self).surface + backgroundColorConfiguration.getColor(self).isDark() ? .dark : .light } //-------------------------------------------------- diff --git a/VDS/Extensions/UIColor+VDSColor.swift b/VDS/Extensions/UIColor+VDSColor.swift index c0d69b59..5ed1b951 100644 --- a/VDS/Extensions/UIColor+VDSColor.swift +++ b/VDS/Extensions/UIColor+VDSColor.swift @@ -187,10 +187,4 @@ extension UIColor { guard let found else { return nil} return found } - - public var surface: Surface { - var greyScale: CGFloat = 0 - getWhite(&greyScale, alpha: nil) - return greyScale < 0.5 ? .dark : .light - } } From 216971b87803c752137a077e70c15b7245cc59de Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Wed, 16 Oct 2024 21:37:01 +0530 Subject: [PATCH 2/4] Fix for CXTDT-578885, Settings appropriate accessibility label for each cell --- VDS/Components/Table/Table.swift | 36 +++++++++++++++++++++++- VDS/Components/Table/TableCellItem.swift | 1 + VDS/SupportingFiles/ReleaseNotes.txt | 4 +++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/VDS/Components/Table/Table.swift b/VDS/Components/Table/Table.swift index 21fe00a4..9413b74f 100644 --- a/VDS/Components/Table/Table.swift +++ b/VDS/Components/Table/Table.swift @@ -27,7 +27,6 @@ open class Table: View { $0.allowsSelection = false $0.showsVerticalScrollIndicator = false $0.showsHorizontalScrollIndicator = false - $0.isAccessibilityElement = true $0.backgroundColor = .clear } @@ -148,6 +147,7 @@ extension Table: UICollectionViewDelegate, UICollectionViewDataSource, TableColl var edgePadding = UIEdgeInsets(top: padding.verticalValue(), left: 0, bottom: padding.verticalValue(), right: padding.horizontalValue()) edgePadding.left = (indexPath.row == 0 && !striped) ? VDSLayout.space1X : padding.horizontalValue() cell.updateCell(content: currentItem, surface: surface, striped: shouldStrip, padding: edgePadding, isHeader: isHeader) + setAccessibilityForCell(cell: cell, content: currentItem, path: indexPath) return cell } @@ -162,4 +162,38 @@ extension Table: UICollectionViewDelegate, UICollectionViewDataSource, TableColl func collectionView(_ collectionView: UICollectionView, widthForItemAt indexPath: IndexPath) -> CGFloat { return columnWidths?[indexPath.row] ?? 0.0 } + + //-------------------------------------------------- + // MARK: - Accessibility + //-------------------------------------------------- + + /// To set the accessibility label for the each cell based on the criteria. Table name along with total no of column & row information should be passed in the first cell's accessibility label. + private func setAccessibilityForCell(cell: TableCellItem, content: TableItemModel, path: IndexPath) { + + var accLabel = content.component?.accessibilityLabel ?? "Empty" + + ///Set the type of header label + if path.section == 0 { + accLabel.append(", Column Header") + } else if path.row == 0 { + ///As per design team, inspite of column 0 may not look like a header, it should be read as header. + accLabel.append(", Row Header") + } + + ///Set the Row/Column number for each cell + if path.row == 0 { + accLabel.append(", Row \(path.section + 1), Column \(path.row + 1)") + } else { + accLabel.append(", Column \(path.row + 1)") + } + + ///Set the Row header accessibilityLabel at the end of the non-header cells accessibilityLabel + if path.section != 0, + path.row != 0, + let columnHeaderAccLabel = tableHeader.first?.columns[path.row].component?.accessibilityLabel { + accLabel.append(", \(columnHeaderAccLabel)") + } + + cell.accessibilityLabel = accLabel + } } diff --git a/VDS/Components/Table/TableCellItem.swift b/VDS/Components/Table/TableCellItem.swift index 0c87fb35..d98c12fc 100644 --- a/VDS/Components/Table/TableCellItem.swift +++ b/VDS/Components/Table/TableCellItem.swift @@ -45,6 +45,7 @@ final class TableCellItem: UICollectionViewCell { private func setupCell() { contentView.backgroundColor = .clear + isAccessibilityElement = true addSubview(containerView) containerView.pinToSuperView() diff --git a/VDS/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index 192e7e44..c35d3eb7 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -1,3 +1,7 @@ +1.0.75 +---------------- +- CXTDT-578885 - Table - Setting appropriate accessiblity label for each cell. + 1.0.74 ---------------- - CXTDT-591307 - DatePicker - Accessibility - #1 & #2 From 4e581491fadc93690ddd697de3032a045ebb046b Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 16 Oct 2024 15:16:05 -0500 Subject: [PATCH 3/4] added initial actionable elements Signed-off-by: Matt Bruce --- VDS/Components/TileContainer/TileContainer.swift | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/VDS/Components/TileContainer/TileContainer.swift b/VDS/Components/TileContainer/TileContainer.swift index 86ae34a3..b8f2fbdd 100644 --- a/VDS/Components/TileContainer/TileContainer.swift +++ b/VDS/Components/TileContainer/TileContainer.swift @@ -346,8 +346,15 @@ open class TileContainerBase: View where containerView.setAccessibilityLabel(for: views) //append all children that are accessible - items.append(contentsOf: elements) - + if containerView.isAccessibilityElement { + elements.forEach({ element in + if element.accessibilityTraits.contains(.button) || element.accessibilityTraits.contains(.link) { + items.append(element) + } + }) + } else { + items.append(contentsOf: elements) + } return items } set {} From 2e3524cde60e0b52213115294b4cf24c07679fe3 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 17 Oct 2024 16:19:41 -0500 Subject: [PATCH 4/4] updated version Signed-off-by: Matt Bruce --- VDS.xcodeproj/project.pbxproj | 4 ++-- VDS/SupportingFiles/ReleaseNotes.txt | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/VDS.xcodeproj/project.pbxproj b/VDS.xcodeproj/project.pbxproj index bb3a0e44..a5a05d74 100644 --- a/VDS.xcodeproj/project.pbxproj +++ b/VDS.xcodeproj/project.pbxproj @@ -1653,7 +1653,7 @@ BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 74; + CURRENT_PROJECT_VERSION = 75; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; @@ -1691,7 +1691,7 @@ BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 74; + CURRENT_PROJECT_VERSION = 75; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; diff --git a/VDS/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index c35d3eb7..6c854af8 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -1,5 +1,6 @@ 1.0.75 ---------------- +- CXTDT-624895 - Badge - Custom FillColor and TextColor - CXTDT-578885 - Table - Setting appropriate accessiblity label for each cell. 1.0.74