diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2021-06-09 12:45:28 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2021-07-14 14:22:04 +0200 |
| commit | e450627e750c02162de8992eacca2f0c3ef8083c (patch) | |
| tree | baca6bc9ffaee709eca8507faff8669511e5a50d /ios | |
| parent | 556ef78590e56d158a4d381fda0da1aa37b5e228 (diff) | |
| download | mullvadvpn-e450627e750c02162de8992eacca2f0c3ef8083c.tar.xz mullvadvpn-e450627e750c02162de8992eacca2f0c3ef8083c.zip | |
Accessibility: add accessibility hint to collapse button
Diffstat (limited to 'ios')
| -rw-r--r-- | ios/MullvadVPN/ConnectionPanelView.swift | 15 | ||||
| -rw-r--r-- | ios/MullvadVPN/en.lproj/Localizable.strings | 2 |
2 files changed, 14 insertions, 3 deletions
diff --git a/ios/MullvadVPN/ConnectionPanelView.swift b/ios/MullvadVPN/ConnectionPanelView.swift index 17b2ccc796..e552d6148f 100644 --- a/ios/MullvadVPN/ConnectionPanelView.swift +++ b/ios/MullvadVPN/ConnectionPanelView.swift @@ -99,6 +99,7 @@ class ConnectionPanelView: UIView { ]) updateConnectionInfoVisibility() + updateCollapseButtonAccessibilityHint() collapseButton.addTarget(self, action: #selector(toggleCollapse(_:)), for: .touchUpInside) } @@ -127,9 +128,17 @@ class ConnectionPanelView: UIView { stackView.isHidden = !showsConnectionInfo collapseButton.style = showsConnectionInfo ? .up : .down - if collapseButton.accessibilityElementIsFocused() { - let nextAccessibleElement = showsConnectionInfo ? stackView.arrangedSubviews.first : collapseButton - UIAccessibility.post(notification: .layoutChanged, argument: nextAccessibleElement) + if collapseButton.accessibilityElementIsFocused(), showsConnectionInfo { + UIAccessibility.post(notification: .layoutChanged, argument: stackView.arrangedSubviews.first) + } + updateCollapseButtonAccessibilityHint() + } + + private func updateCollapseButtonAccessibilityHint() { + if showsConnectionInfo { + collapseButton.accessibilityHint = NSLocalizedString("CONNECTION_PANEL_COLLAPSE_BUTTON_ACCESSIBILITY_HINT", comment: "") + } else { + collapseButton.accessibilityHint = NSLocalizedString("CONNECTION_PANEL_EXPAND_BUTTON_ACCESSIBILITY_HINT", comment: "") } } } diff --git a/ios/MullvadVPN/en.lproj/Localizable.strings b/ios/MullvadVPN/en.lproj/Localizable.strings index b42834aad1..858888d92a 100644 --- a/ios/MullvadVPN/en.lproj/Localizable.strings +++ b/ios/MullvadVPN/en.lproj/Localizable.strings @@ -18,6 +18,8 @@ "ACCOUNT_EXPIRY_INAPP_NOTIFICATION_BODY" = "%@ left. Buy more credit."; "CONNECTION_PANEL_RELAY_ACCESSIBILITY_LABEL" = "Connected relay"; +"CONNECTION_PANEL_COLLAPSE_BUTTON_ACCESSIBILITY_HINT" = "Double tap to collapse the connection info panel."; +"CONNECTION_PANEL_EXPAND_BUTTON_ACCESSIBILITY_HINT" = "Double tap to expand the connection info panel."; "CONNECTION_PANEL_IN_ADDRESS_LABEL" = "In"; "CONNECTION_PANEL_IN_ADDRESS_ACCESSIBILITY_LABEL" = "Input IP address"; "CONNECTION_PANEL_OUT_ADDRESS_LABEL" = "Out"; |
