Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved accessibility for spaces #7312

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions Riot/Assets/en.lproj/Vector.strings
Original file line number Diff line number Diff line change
Expand Up @@ -2119,14 +2119,14 @@ Tap the + to start adding people.";
"spaces_creation_cancel_message" = "Your progress will be lost.";

"spaces_creation_new_rooms_title" = "What are some discussions you’ll have?";
"spaces_creation_new_rooms_message" = "Well create a room for each one.";
"spaces_creation_new_rooms_message" = "We'll create a room for each one. You can create up to three rooms for this step.";
"spaces_creation_new_rooms_room_name_title" = "Room name";
"spaces_creation_new_rooms_general" = "General";
"spaces_creation_new_rooms_random" = "Random";
"spaces_creation_new_rooms_support" = "Support";

"spaces_creation_email_invites_title" = "Invite your team";
"spaces_creation_email_invites_message" = "You can invite them later too.";
"spaces_creation_email_invites_message" = "You can invite your team members by email or by username.";
"spaces_creation_email_invites_email_title" = "Email";

"spaces_creation_sharing_type_title" = "Who are you working with?";
Expand Down Expand Up @@ -2158,6 +2158,15 @@ Tap the + to start adding people.";

"spaces_add_room_missing_permission_message" = "You do not have permissions to add rooms to this space.";

"spaces_creation_settings_next_hint_error" = "error found";
"spaces_creation_settings_next_hint" = "applies settings and takes you to the next step";
"spaces_creation_settings_accessibility_avatar_label" = "space avatar";
"spaces_creation_settings_accessibility_avatar_hint" = "takes you to the image picker for this space";

"spaces_creation_rooms_next_hint" = "Next and creates";
"spaces_creation_email_invites_next_hint_invalid_emails" = "invalid emails %@";
"spaces_creation_invite_by_username_accessibility_hint" = "takes you to a list of team members you can invite.";

// Mark: Leave space

"leave_space_action" = "Leave space";
Expand Down Expand Up @@ -2287,6 +2296,14 @@ Tap the + to start adding people.";
"space_detail_nav_title" = "Space detail";
"space_invite_nav_title" = "Space invite";

"space_selector_list_row_accessibility_unread_messages" = " %@ unread messages";
"space_selector_list_row_accessibility_selected_space" = "currently selected space";
"space_selector_list_row_accessibility_switches_to" = "switches to %@";
"space_selector_list_row_accessibility_invite_hint" = "takes you to space summary and options";
"space_selector_list_row_accessibility_invite" = "takes you to space summary and options";
"space_selector_list_row_accessibility_disclosure_label" = "Content of %@";
"space_selector_list_row_accessibility_disclosure_hint" = "takes you to sub-spaces of %@";

// Mark: - Polls

"poll_edit_form_create_poll" = "Create poll";
Expand Down
60 changes: 58 additions & 2 deletions Riot/Generated/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8119,6 +8119,34 @@ public class VectorL10n: NSObject {
public static var spaceSelectorEmptyViewTitle: String {
return VectorL10n.tr("Vector", "space_selector_empty_view_title")
}
/// takes you to sub-spaces of %@
public static func spaceSelectorListRowAccessibilityDisclosureHint(_ p1: String) -> String {
return VectorL10n.tr("Vector", "space_selector_list_row_accessibility_disclosure_hint", p1)
}
/// Content of %@
public static func spaceSelectorListRowAccessibilityDisclosureLabel(_ p1: String) -> String {
return VectorL10n.tr("Vector", "space_selector_list_row_accessibility_disclosure_label", p1)
}
/// takes you to space summary and options
public static var spaceSelectorListRowAccessibilityInvite: String {
return VectorL10n.tr("Vector", "space_selector_list_row_accessibility_invite")
}
/// takes you to space summary and options
public static var spaceSelectorListRowAccessibilityInviteHint: String {
return VectorL10n.tr("Vector", "space_selector_list_row_accessibility_invite_hint")
}
/// currently selected space
public static var spaceSelectorListRowAccessibilitySelectedSpace: String {
return VectorL10n.tr("Vector", "space_selector_list_row_accessibility_selected_space")
}
/// switches to %@
public static func spaceSelectorListRowAccessibilitySwitchesTo(_ p1: String) -> String {
return VectorL10n.tr("Vector", "space_selector_list_row_accessibility_switches_to", p1)
}
/// %@ unread messages
public static func spaceSelectorListRowAccessibilityUnreadMessages(_ p1: String) -> String {
return VectorL10n.tr("Vector", "space_selector_list_row_accessibility_unread_messages", p1)
}
/// My spaces
public static var spaceSelectorTitle: String {
return VectorL10n.tr("Vector", "space_selector_title")
Expand Down Expand Up @@ -8219,10 +8247,14 @@ public class VectorL10n: NSObject {
public static var spacesCreationEmailInvitesEmailTitle: String {
return VectorL10n.tr("Vector", "spaces_creation_email_invites_email_title")
}
/// You can invite them later too.
/// You can invite your team members by email or by username.
public static var spacesCreationEmailInvitesMessage: String {
return VectorL10n.tr("Vector", "spaces_creation_email_invites_message")
}
/// invalid emails %@
public static func spacesCreationEmailInvitesNextHintInvalidEmails(_ p1: String) -> String {
return VectorL10n.tr("Vector", "spaces_creation_email_invites_next_hint_invalid_emails", p1)
}
/// Invite your team
public static var spacesCreationEmailInvitesTitle: String {
return VectorL10n.tr("Vector", "spaces_creation_email_invites_title")
Expand Down Expand Up @@ -8263,6 +8295,10 @@ public class VectorL10n: NSObject {
public static var spacesCreationInviteByUsername: String {
return VectorL10n.tr("Vector", "spaces_creation_invite_by_username")
}
/// takes you to a list of team members you can invite.
public static var spacesCreationInviteByUsernameAccessibilityHine: String {
return VectorL10n.tr("Vector", "spaces_creation_invite_by_username_accessibility_hine")
}
/// You can invite them later too.
public static var spacesCreationInviteByUsernameMessage: String {
return VectorL10n.tr("Vector", "spaces_creation_invite_by_username_message")
Expand All @@ -8275,7 +8311,7 @@ public class VectorL10n: NSObject {
public static var spacesCreationNewRoomsGeneral: String {
return VectorL10n.tr("Vector", "spaces_creation_new_rooms_general")
}
/// Well create a room for each one.
/// We'll create a room for each one. You can create up to three rooms for this step.
public static var spacesCreationNewRoomsMessage: String {
return VectorL10n.tr("Vector", "spaces_creation_new_rooms_message")
}
Expand Down Expand Up @@ -8327,10 +8363,30 @@ public class VectorL10n: NSObject {
public static var spacesCreationPublicSpaceTitle: String {
return VectorL10n.tr("Vector", "spaces_creation_public_space_title")
}
/// Next and creates
public static var spacesCreationRoomsNextHint: String {
return VectorL10n.tr("Vector", "spaces_creation_rooms_next_hint")
}
/// takes you to the image picker for this space
public static var spacesCreationSettingsAccessibilityAvatarHint: String {
return VectorL10n.tr("Vector", "spaces_creation_settings_accessibility_avatar_hint")
}
/// space avatar
public static var spacesCreationSettingsAccessibilityAvatarLabel: String {
return VectorL10n.tr("Vector", "spaces_creation_settings_accessibility_avatar_label")
}
/// Add some details to help it stand out. You can change these at any point.
public static var spacesCreationSettingsMessage: String {
return VectorL10n.tr("Vector", "spaces_creation_settings_message")
}
/// applies settings and takes you to the next step
public static var spacesCreationSettingsNextHint: String {
return VectorL10n.tr("Vector", "spaces_creation_settings_next_hint")
}
/// error found
public static var spacesCreationSettingsNextHintError: String {
return VectorL10n.tr("Vector", "spaces_creation_settings_next_hint_error")
}
/// A private space to organise your rooms
public static var spacesCreationSharingTypeJustMeDetail: String {
return VectorL10n.tr("Vector", "spaces_creation_sharing_type_just_me_detail")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ class SpaceDetailViewController: UIViewController {
self.view.backgroundColor = theme.colors.background

self.inviterAvatarView.update(theme: theme)
self.inviterAvatarView.accessibilityElementsHidden = true
self.inviterTitleLabel.textColor = theme.colors.secondaryContent
self.inviterTitleLabel.font = theme.fonts.calloutSB
self.inviterIdLabel.textColor = theme.colors.secondaryContent
Expand All @@ -144,6 +145,7 @@ class SpaceDetailViewController: UIViewController {
self.closeButton.backgroundColor = theme.roomInputTextBorder
self.closeButton.tintColor = theme.noticeSecondaryColor
self.avatarView.update(theme: theme)
self.avatarView.accessibilityElementsHidden = true

self.spaceTypeIconView.tintColor = theme.colors.tertiaryContent
self.spaceTypeLabel.font = theme.fonts.callout
Expand Down
2 changes: 2 additions & 0 deletions RiotSwiftUI/Modules/Common/Util/ClearViewModifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ struct ClearViewModifier: ViewModifier {
.padding(.top, alignment == .top ? 8 : 0)
.padding(.bottom, alignment == .bottom ? 8 : 0)
.padding(.trailing, 12)
.accessibilityLabel("clear")
.accessibilityHint("Clears \(text)")
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions RiotSwiftUI/Modules/Common/Util/PasswordButtonModifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ struct PasswordButtonModifier: ViewModifier {
public func body(content: Content) -> some View {
HStack(alignment: .center) {
content
.accessibilitySortPriority(1)

if !text.isEmpty {
Button { isSecureTextVisible.toggle() } label: {
Expand All @@ -47,6 +48,9 @@ struct PasswordButtonModifier: ViewModifier {
.padding(.top, alignment == .top ? 8 : 0)
.padding(.bottom, alignment == .bottom ? 8 : 0)
.padding(.trailing, 12)
.accessibilitySortPriority(0)
.accessibilityLabel("Text visibility toggler")
.accessibilityHint(isSecureTextVisible ? "hide text" : "show text")
}
}
}
Expand Down
12 changes: 10 additions & 2 deletions RiotSwiftUI/Modules/Common/Util/RoundedBorderTextEditor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ struct RoundedBorderTextEditor: View {
.font(theme.fonts.subheadline)
.multilineTextAlignment(.leading)
.padding(EdgeInsets(top: 0, leading: 0, bottom: 8, trailing: 0))
.accessibilityHidden(true)
}
ZStack(alignment: .topLeading) {
if text.isEmpty {
Expand All @@ -53,9 +54,13 @@ struct RoundedBorderTextEditor: View {
.font(theme.fonts.callout)
.foregroundColor(theme.colors.tertiaryContent)
.allowsHitTesting(false)
.accessibilityHidden(true)
}
if isEnabled {
ThemableTextEditor(text: $text, onEditingChanged: { edit in
ThemableTextEditor(text: $text,
defaultAccessibilityLabel: title ?? placeHolder,
accessibilityHint: self.error,
onEditingChanged: { edit in
self.editing = edit
onEditingChanged?(edit)
})
Expand All @@ -67,7 +72,10 @@ struct RoundedBorderTextEditor: View {
onTextChanged?(newText)
})
} else {
ThemableTextEditor(text: $text, onEditingChanged: { edit in
ThemableTextEditor(text: $text,
defaultAccessibilityLabel: title ?? placeHolder,
accessibilityHint: self.error,
onEditingChanged: { edit in
self.editing = edit
onEditingChanged?(edit)
})
Expand Down
5 changes: 4 additions & 1 deletion RiotSwiftUI/Modules/Common/Util/RoundedBorderTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ struct RoundedBorderTextField: View {
.font(theme.fonts.subheadline)
.multilineTextAlignment(.leading)
.padding(.bottom, 8)
.accessibilityHidden(true)
}

ZStack(alignment: .leading) {
Expand All @@ -63,6 +64,8 @@ struct RoundedBorderTextField: View {

ThemableTextField(placeholder: "",
text: $text,
defaultAccessibilityLabel: title ?? placeHolder,
accessibilityHint: self.footerText,
configuration: configuration,
isSecureTextVisible: $isSecureTextVisible) { isEditing in
self.isEditing = isEditing
Expand All @@ -78,7 +81,6 @@ struct RoundedBorderTextField: View {
.frame(height: 30)
.allowsHitTesting(isEnabled)
.opacity(isEnabled ? 1 : 0.5)
.accessibilityLabel(text.isEmpty ? placeHolder : "")
}
.padding(EdgeInsets(top: 8, leading: 8, bottom: 8, trailing: text.isEmpty ? 8 : 0))
.background(RoundedRectangle(cornerRadius: 8).fill(theme.colors.background))
Expand All @@ -91,6 +93,7 @@ struct RoundedBorderTextField: View {
.multilineTextAlignment(.leading)
.padding(.top, 8)
.transition(.opacity)
.accessibilityHidden(true)
}
}
.animation(.easeOut(duration: 0.2))
Expand Down
1 change: 1 addition & 0 deletions RiotSwiftUI/Modules/Common/Util/SearchBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ struct SearchBar: View {
.renderingMode(.template)
.foregroundColor(theme.colors.quarterlyContent)
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
.accessibilityHidden(true)

if isEditing, !text.isEmpty {
Button(action: {
Expand Down
2 changes: 2 additions & 0 deletions RiotSwiftUI/Modules/Common/Util/ThemableNavigationBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ struct ThemableNavigationBar: View {
Image(uiImage: Asset.Images.spacesModalBack.image)
.renderingMode(.template)
.foregroundColor(theme.colors.secondaryContent)
.accessibilityLabel(VectorL10n.back)
}
.isHidden(!showBackButton)
Spacer()
Expand All @@ -51,6 +52,7 @@ struct ThemableNavigationBar: View {
Image(uiImage: Asset.Images.spacesModalClose.image)
.renderingMode(.template)
.foregroundColor(theme.colors.secondaryContent)
.accessibilityLabel(VectorL10n.close)
}
}
.padding(.horizontal)
Expand Down
12 changes: 12 additions & 0 deletions RiotSwiftUI/Modules/Common/Util/ThemableTextEditor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ struct ThemableTextEditor: UIViewRepresentable {

@Binding var text: String
@State var configuration = UIKitTextInputConfiguration()
var defaultAccessibilityLabel: String?
var accessibilityHint: String?
var onEditingChanged: ((_ edit: Bool) -> Void)?

// MARK: Private
Expand All @@ -33,10 +35,14 @@ struct ThemableTextEditor: UIViewRepresentable {
// MARK: Setup

init(text: Binding<String>,
defaultAccessibilityLabel: String?,
accessibilityHint: String?,
configuration: UIKitTextInputConfiguration = UIKitTextInputConfiguration(),
onEditingChanged: ((_ edit: Bool) -> Void)? = nil) {
_text = text
_configuration = State(initialValue: configuration)
self.defaultAccessibilityLabel = defaultAccessibilityLabel
self.accessibilityHint = accessibilityHint
self.onEditingChanged = onEditingChanged

ResponderManager.register(view: textView)
Expand All @@ -51,6 +57,9 @@ struct ThemableTextEditor: UIViewRepresentable {
if internalParams.isFirstResponder {
textView.becomeFirstResponder()
}

textView.accessibilityLabel = defaultAccessibilityLabel
textView.accessibilityHint = accessibilityHint

return textView
}
Expand All @@ -64,6 +73,9 @@ struct ThemableTextEditor: UIViewRepresentable {
if uiView.text != text {
uiView.text = text
}

uiView.accessibilityLabel = defaultAccessibilityLabel
uiView.accessibilityHint = accessibilityHint

uiView.keyboardType = configuration.keyboardType
uiView.returnKeyType = configuration.returnKeyType
Expand Down
11 changes: 11 additions & 0 deletions RiotSwiftUI/Modules/Common/Util/ThemableTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ struct ThemableTextField: UIViewRepresentable {
@Binding var text: String
@State var configuration = UIKitTextInputConfiguration()
@Binding var isSecureTextVisible: Bool
var defaultAccessibilityLabel: String?
var accessibilityHint: String?
var onEditingChanged: ((_ edit: Bool) -> Void)?
var onCommit: (() -> Void)?

Expand All @@ -45,6 +47,8 @@ struct ThemableTextField: UIViewRepresentable {

init(placeholder: String? = nil,
text: Binding<String>,
defaultAccessibilityLabel: String?,
accessibilityHint: String?,
configuration: UIKitTextInputConfiguration = UIKitTextInputConfiguration(),
isSecureTextVisible: Binding<Bool> = .constant(false),
onEditingChanged: ((_ edit: Bool) -> Void)? = nil,
Expand All @@ -53,6 +57,8 @@ struct ThemableTextField: UIViewRepresentable {
_placeholder = State(initialValue: placeholder)
_configuration = State(initialValue: configuration)
_isSecureTextVisible = isSecureTextVisible
self.defaultAccessibilityLabel = defaultAccessibilityLabel
self.accessibilityHint = accessibilityHint
self.onEditingChanged = onEditingChanged
self.onCommit = onCommit

Expand All @@ -67,6 +73,8 @@ struct ThemableTextField: UIViewRepresentable {
textField.setContentHuggingPriority(.defaultLow, for: .horizontal)
textField.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
textField.text = text
textField.accessibilityLabel = defaultAccessibilityLabel
textField.accessibilityHint = accessibilityHint

textField.addTarget(context.coordinator, action: #selector(Coordinator.textFieldEditingChanged(sender:)), for: .editingChanged)

Expand All @@ -88,6 +96,9 @@ struct ThemableTextField: UIViewRepresentable {
}
uiView.placeholder = placeholder

uiView.accessibilityLabel = defaultAccessibilityLabel
uiView.accessibilityHint = accessibilityHint

uiView.keyboardType = configuration.keyboardType
uiView.returnKeyType = configuration.returnKeyType
uiView.isSecureTextEntry = configuration.isSecureTextEntry ? !isSecureTextVisible : false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ final class MatrixItemChooserCoordinator: Coordinator, Presentable {
// Must be used only internally
var childCoordinators: [Coordinator] = []
var completion: ((MatrixItemChooserViewModelResult) -> Void)?
var isNavigationBarHidden: Bool {
get {
return matrixItemChooserHostingController.isNavigationBarHidden
}
set {
matrixItemChooserHostingController.isNavigationBarHidden = newValue
}
}

// MARK: - Setup

Expand Down
Loading