- improved detection of false positives for dynamic type size

- improved also a11y for the knock request message
- improved a11y for reply view
This commit is contained in:
Mauro Romito
2025-07-21 17:51:09 +02:00
committed by Mauro
parent dac4c985d6
commit 8a66cbad68
39 changed files with 83 additions and 77 deletions
@@ -101,13 +101,14 @@ class AccessibilityTestsAppCoordinator: AppCoordinatorProtocol {
struct PreviewsWrapperView: View {
let wrapper: PreviewsWrapper
@Environment(\.dynamicTypeSize) var dynamicTypeSize
var body: some View {
if wrapper.currentIndex < 0 || wrapper.isDone {
EmptyView()
} else {
wrapper.currentPreview.content
.id(wrapper.previewName)
.id("\(wrapper.previewName)-\(dynamicTypeSize)")
}
}
}
+4
View File
@@ -1594,6 +1594,10 @@ internal enum L10n {
internal static var screenJoinRoomJoinRestrictedMessage: String { return L10n.tr("Localizable", "screen_join_room_join_restricted_message") }
/// Send request to join
internal static var screenJoinRoomKnockAction: String { return L10n.tr("Localizable", "screen_join_room_knock_action") }
/// Allowed characters %1$d of %2$d
internal static func screenJoinRoomKnockMessageCharactersCount(_ p1: Int, _ p2: Int) -> String {
return L10n.tr("Localizable", "screen_join_room_knock_message_characters_count", p1, p2)
}
/// Message (optional)
internal static var screenJoinRoomKnockMessageDescription: String { return L10n.tr("Localizable", "screen_join_room_knock_message_description") }
/// You will receive an invite to join the room if your request is accepted.
@@ -11,7 +11,7 @@ import MatrixRustSDK
extension RoomPreviewProxyMock {
struct Configuration {
var roomID = "1"
var canonicalAlias = "#3🌞problem:matrix.org"
var canonicalAlias = "#3-body-problem:matrix.org"
var name = "The Three-Body Problem - 三体"
var topic: String? = "“Science and technology were the only keys to opening the door to the future, and people approached science with the faith and sincerity of elementary school students.”"
var avatarURL = URL.mockMXCAvatar.absoluteString
@@ -69,8 +69,8 @@ struct HomeScreenRecoveryKeyConfirmationBanner: View {
.foregroundColor(.compound.iconSecondary)
.frame(width: 12, height: 12)
// Increase hit area
.padding(.leading, 10)
.padding(.bottom, 10)
.padding(.leading, 5)
.padding(.bottom, 2)
}
}
}
@@ -131,19 +131,12 @@ struct JoinRoomScreen: View {
}
}
}
private var knockMessageFooterString: String {
guard !context.knockMessage.isEmpty else {
return L10n.screenJoinRoomKnockMessageDescription
}
return "\(context.knockMessage.count)/\(maxKnockMessageLength)"
}
@ViewBuilder
private var knockMessage: some View {
VStack(alignment: .leading, spacing: 12) {
HStack(spacing: 0) {
TextField("", text: $context.knockMessage, axis: .vertical)
TextField(L10n.screenJoinRoomKnockMessageDescription, text: $context.knockMessage, axis: .vertical)
.focused($focus, equals: .knockMessage)
.onChange(of: context.knockMessage) { _, newValue in
context.knockMessage = String(newValue.prefix(maxKnockMessageLength))
@@ -153,6 +146,7 @@ struct JoinRoomScreen: View {
.padding(.horizontal, 16)
.padding(.vertical, 12)
.id(Focus.knockMessage)
.accessibilityHint(L10n.screenJoinRoomKnockMessageCharactersCount(context.knockMessage.count, maxKnockMessageLength))
}
.background(.compound.bgCanvasDefault)
.cornerRadius(8)
@@ -160,11 +154,14 @@ struct JoinRoomScreen: View {
RoundedRectangle(cornerRadius: 8)
.inset(by: 0.5)
.stroke(.compound.borderInteractivePrimary)
.accessibilityHidden(true)
}
Text(knockMessageFooterString)
Text("\(context.knockMessage.count)/\(maxKnockMessageLength)")
.font(.compound.bodySM)
.foregroundStyle(.compound.textSecondary)
// We will have a hint for this in voice over mode
.accessibilityHidden(true)
}
}
@@ -97,6 +97,7 @@ struct TimelineReplyView: View {
var body: some View {
ReplyView(sender: .init(id: "@alice:matrix.org"), plainBody: "Hello world", formattedBody: nil)
.redacted(reason: .placeholder)
.accessibilityLabel(L10n.commonLoading)
}
}
@@ -129,6 +130,7 @@ struct TimelineReplyView: View {
.foregroundColor(.compound.iconPrimary)
.background(Color.compound.bgSubtlePrimary)
.cornerRadius(icon?.cornerRadii ?? 0.0, corners: .allCorners)
.accessibilityHidden(true)
VStack(alignment: .leading, spacing: 2) {
Text(sender.disambiguatedDisplayName ?? sender.id)
@@ -145,6 +147,7 @@ struct TimelineReplyView: View {
.padding(.leading, icon == nil ? 8 : 0)
.padding(.trailing, 8)
}
.accessibilityElement(children: .combine)
}
@ViewBuilder