Compose screen VoiceOver improvements

This commit is contained in:
Shadowfacts 2022-11-28 18:33:29 -05:00
parent ea6698a2d8
commit c01bc4d840
4 changed files with 12 additions and 1 deletions

View File

@ -22,7 +22,7 @@ struct ComposeCurrentAccount: View {
ComposeAvatarImageView(url: account?.avatar) ComposeAvatarImageView(url: account?.avatar)
.frame(width: 50, height: 50) .frame(width: 50, height: 50)
.cornerRadius(preferences.avatarStyle.cornerRadiusFraction * 50) .cornerRadius(preferences.avatarStyle.cornerRadiusFraction * 50)
.accessibility(label: Text(account != nil ? "\(account!.displayName) avatar" : "Avatar")) .accessibilityHidden(true)
if let id = account?.id, if let id = account?.id,
let account = mastodonController.persistentContainer.account(for: id) { let account = mastodonController.persistentContainer.account(for: id) {

View File

@ -107,6 +107,11 @@ class ComposeHostingController: UIHostingController<ComposeHostingController.Wra
} }
} }
override func accessibilityPerformEscape() -> Bool {
dismissCompose(mode: .cancel)
return true
}
// MARK: Duckable // MARK: Duckable
func duckableViewControllerWillAnimateDuck(withDuration duration: CGFloat, afterDelay delay: CGFloat) { func duckableViewControllerWillAnimateDuck(withDuration duration: CGFloat, afterDelay delay: CGFloat) {

View File

@ -80,6 +80,7 @@ struct ComposeReplyView: View {
.frame(width: 50, height: 50) .frame(width: 50, height: 50)
.cornerRadius(preferences.avatarStyle.cornerRadiusFraction * 50) .cornerRadius(preferences.avatarStyle.cornerRadiusFraction * 50)
.offset(x: 0, y: offset) .offset(x: 0, y: offset)
.accessibilityHidden(true)
} }
} }

View File

@ -202,11 +202,16 @@ struct ComposeView: View {
private var header: some View { private var header: some View {
HStack(alignment: .top) { HStack(alignment: .top) {
ComposeCurrentAccount() ComposeCurrentAccount()
.accessibilitySortPriority(1)
Spacer() Spacer()
Text(verbatim: charactersRemaining.description) Text(verbatim: charactersRemaining.description)
.foregroundColor(charactersRemaining < 0 ? .red : .secondary) .foregroundColor(charactersRemaining < 0 ? .red : .secondary)
.font(Font.body.monospacedDigit()) .font(Font.body.monospacedDigit())
.accessibility(label: Text(charactersRemaining < 0 ? "\(-charactersRemaining) characters too many" : "\(charactersRemaining) characters remaining")) .accessibility(label: Text(charactersRemaining < 0 ? "\(-charactersRemaining) characters too many" : "\(charactersRemaining) characters remaining"))
// this should come first, so VO users can back to it from the main compose text view
.accessibilitySortPriority(0)
}.frame(height: 50) }.frame(height: 50)
} }