Skip to content

Commit 8e7158b

Browse files
authored
Merge pull request #5225 from woocommerce/issue/5164-offline-banner-accessibility
Add accessibility announcement when offline banner appears or disappears
2 parents fd28126 + 848972b commit 8e7158b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- [*] Shipping Labels: Fix crash when tapping on Learn more rows of customs form. [https://github.com/woocommerce/woocommerce-ios/pull/5207]
1111
- [*] Shipping Labels: The shipping address now prefills the phone number from the billing address if a shipping phone number is not available. [https://github.com/woocommerce/woocommerce-ios/pull/5177]
1212
- [*] Shipping Labels: now in Carrier and Rates we always display the discounted rate instead of the retail rate if available. [https://github.com/woocommerce/woocommerce-ios/pull/5188]
13+
- [*] Accessibility: notify when offline mode banner appears or disappears. [https://github.com/woocommerce/woocommerce-ios/pull/5225]
1314

1415
7.7
1516
-----

WooCommerce/Classes/System/WooNavigationController.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ private extension WooNavigationControllerDelegate {
143143
offlineBannerView.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -extraBottomSpace)
144144
])
145145
viewController.additionalSafeAreaInsets = UIEdgeInsets(top: 0, left: 0, bottom: OfflineBannerView.height, right: 0)
146+
UIAccessibility.post(notification: .announcement, argument: Localization.offlineAnnouncement)
146147
}
147148

148149
/// Removes the offline banner from the view controller if it exists.
@@ -153,5 +154,15 @@ private extension WooNavigationControllerDelegate {
153154
}
154155
offlineBanner.removeFromSuperview()
155156
viewController.additionalSafeAreaInsets = .zero
157+
UIAccessibility.post(notification: .announcement, argument: Localization.onlineAnnouncement)
158+
}
159+
}
160+
161+
private extension WooNavigationControllerDelegate {
162+
enum Localization {
163+
static let offlineAnnouncement = NSLocalizedString("Offline - using cached data",
164+
comment: "Accessibility announcement message when device goes offline")
165+
static let onlineAnnouncement = NSLocalizedString("Back online",
166+
comment: "Accessibility announcement message when device goes back online")
156167
}
157168
}

0 commit comments

Comments
 (0)