From c01bc4d84067f9d51e7d6cd6bddb84f7162e7b77 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 28 Nov 2022 18:33:29 -0500 Subject: [PATCH] Compose screen VoiceOver improvements --- Tusker/Screens/Compose/ComposeCurrentAccount.swift | 2 +- Tusker/Screens/Compose/ComposeHostingController.swift | 5 +++++ Tusker/Screens/Compose/ComposeReplyView.swift | 1 + Tusker/Screens/Compose/ComposeView.swift | 5 +++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Tusker/Screens/Compose/ComposeCurrentAccount.swift b/Tusker/Screens/Compose/ComposeCurrentAccount.swift index 6bb471ff62..878c613977 100644 --- a/Tusker/Screens/Compose/ComposeCurrentAccount.swift +++ b/Tusker/Screens/Compose/ComposeCurrentAccount.swift @@ -22,7 +22,7 @@ struct ComposeCurrentAccount: View { ComposeAvatarImageView(url: account?.avatar) .frame(width: 50, height: 50) .cornerRadius(preferences.avatarStyle.cornerRadiusFraction * 50) - .accessibility(label: Text(account != nil ? "\(account!.displayName) avatar" : "Avatar")) + .accessibilityHidden(true) if let id = account?.id, let account = mastodonController.persistentContainer.account(for: id) { diff --git a/Tusker/Screens/Compose/ComposeHostingController.swift b/Tusker/Screens/Compose/ComposeHostingController.swift index d2dd2509a0..d346604d17 100644 --- a/Tusker/Screens/Compose/ComposeHostingController.swift +++ b/Tusker/Screens/Compose/ComposeHostingController.swift @@ -107,6 +107,11 @@ class ComposeHostingController: UIHostingController Bool { + dismissCompose(mode: .cancel) + return true + } + // MARK: Duckable func duckableViewControllerWillAnimateDuck(withDuration duration: CGFloat, afterDelay delay: CGFloat) { diff --git a/Tusker/Screens/Compose/ComposeReplyView.swift b/Tusker/Screens/Compose/ComposeReplyView.swift index 8f38035985..0ada5abec8 100644 --- a/Tusker/Screens/Compose/ComposeReplyView.swift +++ b/Tusker/Screens/Compose/ComposeReplyView.swift @@ -80,6 +80,7 @@ struct ComposeReplyView: View { .frame(width: 50, height: 50) .cornerRadius(preferences.avatarStyle.cornerRadiusFraction * 50) .offset(x: 0, y: offset) + .accessibilityHidden(true) } } diff --git a/Tusker/Screens/Compose/ComposeView.swift b/Tusker/Screens/Compose/ComposeView.swift index 32f6a3baa5..c9eaaeddbf 100644 --- a/Tusker/Screens/Compose/ComposeView.swift +++ b/Tusker/Screens/Compose/ComposeView.swift @@ -202,11 +202,16 @@ struct ComposeView: View { private var header: some View { HStack(alignment: .top) { ComposeCurrentAccount() + .accessibilitySortPriority(1) + Spacer() + Text(verbatim: charactersRemaining.description) .foregroundColor(charactersRemaining < 0 ? .red : .secondary) .font(Font.body.monospacedDigit()) .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) }