diff --git a/Localization/Localizable.stringsdict b/Localization/Localizable.stringsdict index cd97825f4..f8964ca5d 100644 --- a/Localization/Localizable.stringsdict +++ b/Localization/Localizable.stringsdict @@ -13,15 +13,15 @@ NSStringFormatValueTypeKey ld zero - no unread notification + no unread notifications one 1 unread notification few %ld unread notifications many - %ld unread notification + %ld unread notifications other - %ld unread notification + %ld unread notifications a11y.plural.count.input_limit_exceeds diff --git a/Localization/StringsConvertor/input/Base.lproj/Localizable.stringsdict b/Localization/StringsConvertor/input/Base.lproj/Localizable.stringsdict index cd97825f4..f8964ca5d 100644 --- a/Localization/StringsConvertor/input/Base.lproj/Localizable.stringsdict +++ b/Localization/StringsConvertor/input/Base.lproj/Localizable.stringsdict @@ -13,15 +13,15 @@ NSStringFormatValueTypeKey ld zero - no unread notification + no unread notifications one 1 unread notification few %ld unread notifications many - %ld unread notification + %ld unread notifications other - %ld unread notification + %ld unread notifications a11y.plural.count.input_limit_exceeds diff --git a/Mastodon/Scene/Account/AccountListViewModel.swift b/Mastodon/Scene/Account/AccountListViewModel.swift index e0aaf97fc..75797fd47 100644 --- a/Mastodon/Scene/Account/AccountListViewModel.swift +++ b/Mastodon/Scene/Account/AccountListViewModel.swift @@ -166,7 +166,7 @@ extension AccountListViewModel { cell.badgeButton.accessibilityLabel ] .compactMap { $0 } - .joined(separator: " ") + .joined(separator: ", ") } } diff --git a/Mastodon/Scene/Account/AccountViewController.swift b/Mastodon/Scene/Account/AccountViewController.swift index e25c75b01..7a0e529cc 100644 --- a/Mastodon/Scene/Account/AccountViewController.swift +++ b/Mastodon/Scene/Account/AccountViewController.swift @@ -34,7 +34,9 @@ final class AccountListViewController: UIViewController, NeedsDependency { return barButtonItem }() - let dragIndicatorView = DragIndicatorView() + lazy var dragIndicatorView = DragIndicatorView { [weak self] in + self?.dismiss(animated: true, completion: nil) + } var hasLoaded = false private(set) lazy var tableView: UITableView = { @@ -130,14 +132,6 @@ extension AccountListViewController { self.panModalTransition(to: .shortForm) } .store(in: &disposeBag) - - if UIAccessibility.isVoiceOverRunning { - let dragIndicatorTapGestureRecognizer = UITapGestureRecognizer.singleTapGestureRecognizer - dragIndicatorView.addGestureRecognizer(dragIndicatorTapGestureRecognizer) - dragIndicatorTapGestureRecognizer.addTarget(self, action: #selector(AccountListViewController.dragIndicatorTapGestureRecognizerHandler(_:))) - dragIndicatorView.isAccessibilityElement = true - dragIndicatorView.accessibilityLabel = L10n.Scene.AccountList.dismissAccountSwitcher - } } private func setupBackgroundColor(theme: Theme) { @@ -160,10 +154,11 @@ extension AccountListViewController { logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") _ = coordinator.present(scene: .welcome, from: self, transition: .modal(animated: true, completion: nil)) } - - @objc private func dragIndicatorTapGestureRecognizerHandler(_ sender: UITapGestureRecognizer) { + + override func accessibilityPerformEscape() -> Bool { logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") dismiss(animated: true, completion: nil) + return true } } diff --git a/Mastodon/Scene/Account/Cell/AccountListTableViewCell.swift b/Mastodon/Scene/Account/Cell/AccountListTableViewCell.swift index 66f49efe8..cd214f2c7 100644 --- a/Mastodon/Scene/Account/Cell/AccountListTableViewCell.swift +++ b/Mastodon/Scene/Account/Cell/AccountListTableViewCell.swift @@ -69,6 +69,7 @@ extension AccountListTableViewCell { ]) avatarButton.setContentHuggingPriority(.defaultLow, for: .horizontal) avatarButton.setContentHuggingPriority(.defaultLow, for: .vertical) + avatarButton.isAccessibilityElement = false let labelContainerStackView = UIStackView() labelContainerStackView.axis = .vertical @@ -124,6 +125,8 @@ extension AccountListTableViewCell { badgeButton.setBadge(number: 0) checkmarkImageView.isHidden = true + + accessibilityTraits.insert(.button) } } diff --git a/Mastodon/Scene/Account/Cell/AddAccountTableViewCell.swift b/Mastodon/Scene/Account/Cell/AddAccountTableViewCell.swift index 3ff3066a2..bc47aef43 100644 --- a/Mastodon/Scene/Account/Cell/AddAccountTableViewCell.swift +++ b/Mastodon/Scene/Account/Cell/AddAccountTableViewCell.swift @@ -108,6 +108,8 @@ extension AddAccountTableViewCell { separatorLine.bottomAnchor.constraint(equalTo: contentView.bottomAnchor), separatorLine.heightAnchor.constraint(equalToConstant: UIView.separatorLineHeight(of: contentView)), ]) + + accessibilityTraits.insert(.button) } } diff --git a/Mastodon/Scene/Account/View/DragIndicatorView.swift b/Mastodon/Scene/Account/View/DragIndicatorView.swift index 9e0ab77d5..a04d9cd8c 100644 --- a/Mastodon/Scene/Account/View/DragIndicatorView.swift +++ b/Mastodon/Scene/Account/View/DragIndicatorView.swift @@ -15,17 +15,17 @@ final class DragIndicatorView: UIView { let barView = UIView() let separatorLine = UIView.separatorLine + let onDismiss: () -> Void - override init(frame: CGRect) { - super.init(frame: frame) + init(onDismiss: @escaping () -> Void) { + self.onDismiss = onDismiss + super.init(frame: .zero) _init() } required init?(coder: NSCoder) { - super.init(coder: coder) - _init() + fatalError("init(coder:) is not supported") } - } extension DragIndicatorView { @@ -52,6 +52,14 @@ extension DragIndicatorView { separatorLine.bottomAnchor.constraint(equalTo: bottomAnchor), separatorLine.heightAnchor.constraint(equalToConstant: UIView.separatorLineHeight(of: self)), ]) + + isAccessibilityElement = true + accessibilityTraits = .button + accessibilityLabel = L10n.Scene.AccountList.dismissAccountSwitcher } + override func accessibilityActivate() -> Bool { + self.onDismiss() + return true + } } diff --git a/Mastodon/Scene/Root/MainTab/MainTabBarController.swift b/Mastodon/Scene/Root/MainTab/MainTabBarController.swift index 987c1141b..48d974358 100644 --- a/Mastodon/Scene/Root/MainTab/MainTabBarController.swift +++ b/Mastodon/Scene/Root/MainTab/MainTabBarController.swift @@ -306,12 +306,11 @@ extension MainTabBarController { guard user.managedObjectContext != nil else { return } self.avatarURL = user.avatarImageURL() } - + // a11y let _profileTabItem = self.tabBar.items?.first { item in item.tag == Tab.me.tag } guard let profileTabItem = _profileTabItem else { return } - let currentUserDisplayName = user.displayNameWithFallback ?? "no user" - profileTabItem.accessibilityHint = L10n.Scene.AccountList.tabBarHint(currentUserDisplayName) + profileTabItem.accessibilityHint = L10n.Scene.AccountList.tabBarHint(user.displayNameWithFallback) context.authenticationService.updateActiveUserAccountPublisher .sink { [weak self] in diff --git a/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.stringsdict b/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.stringsdict index cd97825f4..f8964ca5d 100644 --- a/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.stringsdict +++ b/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.stringsdict @@ -13,15 +13,15 @@ NSStringFormatValueTypeKey ld zero - no unread notification + no unread notifications one 1 unread notification few %ld unread notifications many - %ld unread notification + %ld unread notifications other - %ld unread notification + %ld unread notifications a11y.plural.count.input_limit_exceeds