Improve accessibility

This commit is contained in:
Alfonso Grillo
2023-01-16 12:01:24 +01:00
parent 2a5bcf9f44
commit 4b684b20a3
4 changed files with 11 additions and 3 deletions
@@ -23,11 +23,12 @@ class PollHistoryUITests: MockScreenTestCase {
let title = app.navigationBars.firstMatch.identifier
let emptyText = app.staticTexts["PollHistory.emptyText"]
let items = app.staticTexts["PollListItem.title"]
let selectedSegment = app.buttons["\(VectorL10n.pollHistoryActiveSegmentTitle)-selected"]
let selectedSegment = app.buttons[VectorL10n.pollHistoryActiveSegmentTitle]
XCTAssertEqual(title, VectorL10n.pollHistoryTitle)
XCTAssertTrue(items.exists)
XCTAssertFalse(emptyText.exists)
XCTAssertTrue(selectedSegment.exists)
XCTAssertEqual(selectedSegment.value as? String, VectorL10n.accessibilitySelected)
}
func testPollHistoryShowsEmptyScreen() {
@@ -35,10 +36,11 @@ class PollHistoryUITests: MockScreenTestCase {
let title = app.navigationBars.firstMatch.identifier
let emptyText = app.staticTexts["PollHistory.emptyText"]
let items = app.staticTexts["PollListItem.title"]
let selectedSegment = app.buttons["\(VectorL10n.pollHistoryPastSegmentTitle)-selected"]
let selectedSegment = app.buttons[VectorL10n.pollHistoryPastSegmentTitle]
XCTAssertEqual(title, VectorL10n.pollHistoryTitle)
XCTAssertFalse(items.exists)
XCTAssertTrue(emptyText.exists)
XCTAssertTrue(selectedSegment.exists)
XCTAssertEqual(selectedSegment.value as? String, VectorL10n.accessibilitySelected)
}
}
@@ -42,7 +42,8 @@ struct SegmentedPicker<Segment: Hashable & CustomStringConvertible>: View {
.underline(isSelectedSegment)
}
.accentColor(isSelectedSegment ? theme.colors.accent : theme.colors.primaryContent)
.accessibilityLabel(segment.description + (isSelectedSegment ? "-selected" : ""))
.accessibilityLabel(segment.description)
.accessibilityValue(isSelectedSegment ? VectorL10n.accessibilitySelected : "")
}
}
}