mirror of
https://github.com/mastodon/mastodon-ios
synced 2025-04-11 22:58:02 +02:00
Make UserView accessible
This commit is contained in:
parent
d933f2d0cb
commit
21e4a81ca7
@ -54,6 +54,8 @@ extension SearchHistoryUserCollectionViewCell {
|
|||||||
contentView.trailingAnchor.constraint(equalTo: userView.trailingAnchor, constant: 16),
|
contentView.trailingAnchor.constraint(equalTo: userView.trailingAnchor, constant: 16),
|
||||||
userView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
|
userView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
userView.accessibilityTraits.insert(.button)
|
||||||
}
|
}
|
||||||
|
|
||||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
override func updateConfiguration(using state: UICellConfigurationState) {
|
||||||
|
@ -61,6 +61,8 @@ extension UserTableViewCell {
|
|||||||
separatorLine.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
|
separatorLine.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
|
||||||
separatorLine.heightAnchor.constraint(equalToConstant: UIView.separatorLineHeight(of: contentView)).priority(.required - 1),
|
separatorLine.heightAnchor.constraint(equalToConstant: UIView.separatorLineHeight(of: contentView)).priority(.required - 1),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
userView.accessibilityTraits.insert(.button)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -52,15 +52,27 @@ extension UserView.ViewModel {
|
|||||||
}
|
}
|
||||||
.store(in: &disposeBag)
|
.store(in: &disposeBag)
|
||||||
// username
|
// username
|
||||||
$authorUsername
|
let displayUsername = $authorUsername
|
||||||
.map { text -> String in
|
.map { text -> String in
|
||||||
guard let text = text else { return "" }
|
guard let text = text else { return "" }
|
||||||
return "@\(text)"
|
return "@\(text)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
displayUsername
|
||||||
.sink { username in
|
.sink { username in
|
||||||
let metaContent = PlaintextMetaContent(string: username)
|
let metaContent = PlaintextMetaContent(string: username)
|
||||||
userView.authorUsernameLabel.configure(content: metaContent)
|
userView.authorUsernameLabel.configure(content: metaContent)
|
||||||
}
|
}
|
||||||
.store(in: &disposeBag)
|
.store(in: &disposeBag)
|
||||||
|
|
||||||
|
Publishers.CombineLatest($authorName, displayUsername)
|
||||||
|
.sink { name, username in
|
||||||
|
if let name {
|
||||||
|
userView.accessibilityLabel = "\(name.string), \(username)"
|
||||||
|
} else {
|
||||||
|
userView.accessibilityLabel = username
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.store(in: &disposeBag)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,6 +90,8 @@ extension UserView {
|
|||||||
avatarButton.isUserInteractionEnabled = false
|
avatarButton.isUserInteractionEnabled = false
|
||||||
authorNameLabel.isUserInteractionEnabled = false
|
authorNameLabel.isUserInteractionEnabled = false
|
||||||
authorUsernameLabel.isUserInteractionEnabled = false
|
authorUsernameLabel.isUserInteractionEnabled = false
|
||||||
|
|
||||||
|
isAccessibilityElement = true
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user