Merge pull request #520 from j-f1/account-switcher-a11y
Improve accessibility of the account switcher
This commit is contained in:
commit
c2bb14eaab
|
@ -13,15 +13,15 @@
|
||||||
<key>NSStringFormatValueTypeKey</key>
|
<key>NSStringFormatValueTypeKey</key>
|
||||||
<string>ld</string>
|
<string>ld</string>
|
||||||
<key>zero</key>
|
<key>zero</key>
|
||||||
<string>no unread notification</string>
|
<string>no unread notifications</string>
|
||||||
<key>one</key>
|
<key>one</key>
|
||||||
<string>1 unread notification</string>
|
<string>1 unread notification</string>
|
||||||
<key>few</key>
|
<key>few</key>
|
||||||
<string>%ld unread notifications</string>
|
<string>%ld unread notifications</string>
|
||||||
<key>many</key>
|
<key>many</key>
|
||||||
<string>%ld unread notification</string>
|
<string>%ld unread notifications</string>
|
||||||
<key>other</key>
|
<key>other</key>
|
||||||
<string>%ld unread notification</string>
|
<string>%ld unread notifications</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>a11y.plural.count.input_limit_exceeds</key>
|
<key>a11y.plural.count.input_limit_exceeds</key>
|
||||||
|
|
|
@ -13,15 +13,15 @@
|
||||||
<key>NSStringFormatValueTypeKey</key>
|
<key>NSStringFormatValueTypeKey</key>
|
||||||
<string>ld</string>
|
<string>ld</string>
|
||||||
<key>zero</key>
|
<key>zero</key>
|
||||||
<string>no unread notification</string>
|
<string>no unread notifications</string>
|
||||||
<key>one</key>
|
<key>one</key>
|
||||||
<string>1 unread notification</string>
|
<string>1 unread notification</string>
|
||||||
<key>few</key>
|
<key>few</key>
|
||||||
<string>%ld unread notifications</string>
|
<string>%ld unread notifications</string>
|
||||||
<key>many</key>
|
<key>many</key>
|
||||||
<string>%ld unread notification</string>
|
<string>%ld unread notifications</string>
|
||||||
<key>other</key>
|
<key>other</key>
|
||||||
<string>%ld unread notification</string>
|
<string>%ld unread notifications</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>a11y.plural.count.input_limit_exceeds</key>
|
<key>a11y.plural.count.input_limit_exceeds</key>
|
||||||
|
|
|
@ -166,7 +166,7 @@ extension AccountListViewModel {
|
||||||
cell.badgeButton.accessibilityLabel
|
cell.badgeButton.accessibilityLabel
|
||||||
]
|
]
|
||||||
.compactMap { $0 }
|
.compactMap { $0 }
|
||||||
.joined(separator: " ")
|
.joined(separator: ", ")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,9 @@ final class AccountListViewController: UIViewController, NeedsDependency {
|
||||||
return barButtonItem
|
return barButtonItem
|
||||||
}()
|
}()
|
||||||
|
|
||||||
let dragIndicatorView = DragIndicatorView()
|
lazy var dragIndicatorView = DragIndicatorView { [weak self] in
|
||||||
|
self?.dismiss(animated: true, completion: nil)
|
||||||
|
}
|
||||||
|
|
||||||
var hasLoaded = false
|
var hasLoaded = false
|
||||||
private(set) lazy var tableView: UITableView = {
|
private(set) lazy var tableView: UITableView = {
|
||||||
|
@ -130,14 +132,6 @@ extension AccountListViewController {
|
||||||
self.panModalTransition(to: .shortForm)
|
self.panModalTransition(to: .shortForm)
|
||||||
}
|
}
|
||||||
.store(in: &disposeBag)
|
.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) {
|
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)")
|
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))
|
_ = 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)")
|
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)")
|
||||||
dismiss(animated: true, completion: nil)
|
dismiss(animated: true, completion: nil)
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,7 @@ extension AccountListTableViewCell {
|
||||||
])
|
])
|
||||||
avatarButton.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
avatarButton.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
||||||
avatarButton.setContentHuggingPriority(.defaultLow, for: .vertical)
|
avatarButton.setContentHuggingPriority(.defaultLow, for: .vertical)
|
||||||
|
avatarButton.isAccessibilityElement = false
|
||||||
|
|
||||||
let labelContainerStackView = UIStackView()
|
let labelContainerStackView = UIStackView()
|
||||||
labelContainerStackView.axis = .vertical
|
labelContainerStackView.axis = .vertical
|
||||||
|
@ -124,6 +125,8 @@ extension AccountListTableViewCell {
|
||||||
|
|
||||||
badgeButton.setBadge(number: 0)
|
badgeButton.setBadge(number: 0)
|
||||||
checkmarkImageView.isHidden = true
|
checkmarkImageView.isHidden = true
|
||||||
|
|
||||||
|
accessibilityTraits.insert(.button)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,6 +108,8 @@ extension AddAccountTableViewCell {
|
||||||
separatorLine.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
|
separatorLine.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
|
||||||
separatorLine.heightAnchor.constraint(equalToConstant: UIView.separatorLineHeight(of: contentView)),
|
separatorLine.heightAnchor.constraint(equalToConstant: UIView.separatorLineHeight(of: contentView)),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
accessibilityTraits.insert(.button)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,17 +15,17 @@ final class DragIndicatorView: UIView {
|
||||||
|
|
||||||
let barView = UIView()
|
let barView = UIView()
|
||||||
let separatorLine = UIView.separatorLine
|
let separatorLine = UIView.separatorLine
|
||||||
|
let onDismiss: () -> Void
|
||||||
|
|
||||||
override init(frame: CGRect) {
|
init(onDismiss: @escaping () -> Void) {
|
||||||
super.init(frame: frame)
|
self.onDismiss = onDismiss
|
||||||
|
super.init(frame: .zero)
|
||||||
_init()
|
_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder: NSCoder) {
|
required init?(coder: NSCoder) {
|
||||||
super.init(coder: coder)
|
fatalError("init(coder:) is not supported")
|
||||||
_init()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension DragIndicatorView {
|
extension DragIndicatorView {
|
||||||
|
@ -52,6 +52,14 @@ extension DragIndicatorView {
|
||||||
separatorLine.bottomAnchor.constraint(equalTo: bottomAnchor),
|
separatorLine.bottomAnchor.constraint(equalTo: bottomAnchor),
|
||||||
separatorLine.heightAnchor.constraint(equalToConstant: UIView.separatorLineHeight(of: self)),
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -306,12 +306,11 @@ extension MainTabBarController {
|
||||||
guard user.managedObjectContext != nil else { return }
|
guard user.managedObjectContext != nil else { return }
|
||||||
self.avatarURL = user.avatarImageURL()
|
self.avatarURL = user.avatarImageURL()
|
||||||
}
|
}
|
||||||
|
|
||||||
// a11y
|
// a11y
|
||||||
let _profileTabItem = self.tabBar.items?.first { item in item.tag == Tab.me.tag }
|
let _profileTabItem = self.tabBar.items?.first { item in item.tag == Tab.me.tag }
|
||||||
guard let profileTabItem = _profileTabItem else { return }
|
guard let profileTabItem = _profileTabItem else { return }
|
||||||
let currentUserDisplayName = user.displayNameWithFallback ?? "no user"
|
profileTabItem.accessibilityHint = L10n.Scene.AccountList.tabBarHint(user.displayNameWithFallback)
|
||||||
profileTabItem.accessibilityHint = L10n.Scene.AccountList.tabBarHint(currentUserDisplayName)
|
|
||||||
|
|
||||||
context.authenticationService.updateActiveUserAccountPublisher
|
context.authenticationService.updateActiveUserAccountPublisher
|
||||||
.sink { [weak self] in
|
.sink { [weak self] in
|
||||||
|
|
|
@ -13,15 +13,15 @@
|
||||||
<key>NSStringFormatValueTypeKey</key>
|
<key>NSStringFormatValueTypeKey</key>
|
||||||
<string>ld</string>
|
<string>ld</string>
|
||||||
<key>zero</key>
|
<key>zero</key>
|
||||||
<string>no unread notification</string>
|
<string>no unread notifications</string>
|
||||||
<key>one</key>
|
<key>one</key>
|
||||||
<string>1 unread notification</string>
|
<string>1 unread notification</string>
|
||||||
<key>few</key>
|
<key>few</key>
|
||||||
<string>%ld unread notifications</string>
|
<string>%ld unread notifications</string>
|
||||||
<key>many</key>
|
<key>many</key>
|
||||||
<string>%ld unread notification</string>
|
<string>%ld unread notifications</string>
|
||||||
<key>other</key>
|
<key>other</key>
|
||||||
<string>%ld unread notification</string>
|
<string>%ld unread notifications</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>a11y.plural.count.input_limit_exceeds</key>
|
<key>a11y.plural.count.input_limit_exceeds</key>
|
||||||
|
|
Loading…
Reference in New Issue