diff --git a/ElementX/Sources/Other/UserIndicator/UserIndicatorController.swift b/ElementX/Sources/Other/UserIndicator/UserIndicatorController.swift index 2fa5dfe35..6f33ed079 100644 --- a/ElementX/Sources/Other/UserIndicator/UserIndicatorController.swift +++ b/ElementX/Sources/Other/UserIndicator/UserIndicatorController.swift @@ -44,6 +44,7 @@ class UserIndicatorController: ObservableObject, UserIndicatorControllerProtocol if let index = indicatorQueue.firstIndex(where: { $0.id == indicator.id }) { indicatorQueue[index] = indicator displayTimes[indicator.id] = .now + announceIfNeeded(indicator) } else { if let delay { delayedIndicators.insert(indicator.id) @@ -90,5 +91,16 @@ class UserIndicatorController: ObservableObject, UserIndicatorControllerProtocol retractIndicatorWithId(indicator.id) indicatorQueue.append(indicator) displayTimes[indicator.id] = .now + announceIfNeeded(indicator) + } + + private func announceIfNeeded(_ indicator: UserIndicator) { + guard case .toast = indicator.type else { + return + } + + var announcement = AttributedString(indicator.title) + announcement.accessibilitySpeechAnnouncementPriority = .high + AccessibilityNotification.Announcement(announcement).post() } } diff --git a/ElementX/Sources/Other/UserIndicator/UserIndicatorToastView.swift b/ElementX/Sources/Other/UserIndicator/UserIndicatorToastView.swift index 127f156f3..84c70e753 100644 --- a/ElementX/Sources/Other/UserIndicator/UserIndicatorToastView.swift +++ b/ElementX/Sources/Other/UserIndicator/UserIndicatorToastView.swift @@ -33,6 +33,7 @@ struct UserIndicatorToastView: View { .background(Color.compound.bgSubtlePrimary) .clipShape(RoundedCornerShape(radius: 24.0, corners: .allCorners)) .shadow(color: .black.opacity(0.1), radius: 6.0, y: 4.0) + .accessibilityHidden(true) .transition(toastTransition) }