diff --git a/MVMCoreUI/Atomic/Molecules/TopNotification/CollapsableNotification.swift b/MVMCoreUI/Atomic/Molecules/TopNotification/CollapsableNotification.swift index 8539c817..82983f4d 100644 --- a/MVMCoreUI/Atomic/Molecules/TopNotification/CollapsableNotification.swift +++ b/MVMCoreUI/Atomic/Molecules/TopNotification/CollapsableNotification.swift @@ -160,7 +160,7 @@ import Foundation /// Collapse if focus is no longer on this top alert. @objc func accessibilityFocusChanged(notification: Notification) { - if !MVMCoreUIUtility.viewContainsAccessiblityFocus(self) { + if (notification.userInfo?[UIAccessibility.focusedElementUserInfoKey] != nil) && !MVMCoreUIUtility.viewContainsAccessiblityFocus(self) { NotificationCenter.default.removeObserver(self, name: UIAccessibility.elementFocusedNotification, object: nil) collapse() } diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertExpandableView.m b/MVMCoreUI/TopAlert/MVMCoreUITopAlertExpandableView.m index 46ecd793..405dd781 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertExpandableView.m +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertExpandableView.m @@ -423,7 +423,7 @@ } - (void)accessibilityFocusChanged:(NSNotification *)notification { - if (![MVMCoreUIUtility viewContainsAccessiblityFocus:self]) { + if (notification.userInfo[UIAccessibilityFocusedElementKey] && ![MVMCoreUIUtility viewContainsAccessiblityFocus:self]) { [[NSNotificationCenter defaultCenter] removeObserver:self name:UIAccessibilityElementFocusedNotification object:nil]; [self collapse]; } diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m index ad0a833f..eba4cfcc 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m @@ -335,7 +335,7 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed."; /// If the voice over user leaves top alert focus, hide. - (void)accessibilityFocusChanged:(NSNotification *)notification { - if (![MVMCoreUIUtility viewContainsAccessiblityFocus:self]) { + if (notification.userInfo[UIAccessibilityFocusedElementKey] && ![MVMCoreUIUtility viewContainsAccessiblityFocus:self]) { [[NSNotificationCenter defaultCenter] removeObserver:self name:UIAccessibilityElementFocusedNotification object:nil]; [self hideAlertView:YES completionHandler:self.hideCompletionHandler]; self.hideCompletionHandler = nil;