diff --git a/Mastodon/Scene/Share/View/Content/UserView+Configuration.swift b/Mastodon/Scene/Share/View/Content/UserView+Configuration.swift index a2ccff02a..4b6e1770c 100644 --- a/Mastodon/Scene/Share/View/Content/UserView+Configuration.swift +++ b/Mastodon/Scene/Share/View/Content/UserView+Configuration.swift @@ -65,5 +65,11 @@ extension UserView { authorVerifiedLabel.configure(content: PlaintextMetaContent(string: L10n.Common.UserList.noVerifiedLink)) authorVerifiedLabel.textColor = .secondaryLabel } + + configureA11y(displayName: account.displayNameWithFallback, userName: "@\(account.username)", followersCountLabel: L10n.Common.UserList.followersCount(count)) + } + + func configureA11y(displayName: String, userName: String, followersCountLabel: String) { + accessibilityLabel = "\(displayName), \(userName), \(followersCountLabel)" } } diff --git a/Mastodon/Scene/Share/View/TableviewCell/UserTableViewCell.swift b/Mastodon/Scene/Share/View/TableviewCell/UserTableViewCell.swift index 0f316bad8..8aafc1a1e 100644 --- a/Mastodon/Scene/Share/View/TableviewCell/UserTableViewCell.swift +++ b/Mastodon/Scene/Share/View/TableviewCell/UserTableViewCell.swift @@ -66,8 +66,5 @@ extension UserTableViewCell { separatorLine.bottomAnchor.constraint(equalTo: contentView.bottomAnchor), separatorLine.heightAnchor.constraint(equalToConstant: UIView.separatorLineHeight(of: contentView)).priority(.required - 1), ]) - - userView.accessibilityTraits.insert(.button) } - } diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/UserView.swift b/MastodonSDK/Sources/MastodonUI/View/Content/UserView.swift index a2e35e558..1deb30abb 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/UserView.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/UserView.swift @@ -345,6 +345,16 @@ public extension UserView { } followButton.addTarget(self, action: #selector(didTapFollowButton), for: .touchUpInside) + + accessibilityHint = L10n.Common.Controls.Status.showUserProfile + guard let followButtonLabel = followButton.configuration?.title, !followButton.isHidden, followButton.isEnabled else { accessibilityCustomActions = []; return } + accessibilityCustomActions = [ + UIAccessibilityCustomAction(name: followButtonLabel) { [weak self] action in + guard let self else { return false } + self.didTapFollowButton() + return true + } + ] } }