Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

Commit 85afe0c

Browse files
authored
Merge pull request #166 from wordpress-mobile/fix/login-voiceover-enhancements
[VoiceOver] Login and Signup enhancements
2 parents 9add480 + 59cc2ac commit 85afe0c

File tree

4 files changed

+58
-3
lines changed

4 files changed

+58
-3
lines changed

WordPressAuthenticator.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "WordPressAuthenticator"
3-
s.version = "1.10.5-beta.2"
3+
s.version = "1.10.5-beta.3"
44
s.summary = "WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps."
55

66
s.description = <<-DESC

WordPressAuthenticator/Signin/Login.storyboard

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
</constraints>
6767
</view>
6868
<connections>
69+
<outlet property="dismissButton" destination="gpM-nW-lFQ" id="8iA-TH-TF4"/>
6970
<segue destination="fwZ-QE-5et" kind="show" identifier="showEmailLogin" id="1xT-tL-sp6"/>
7071
</connections>
7172
</viewController>
@@ -1450,6 +1451,9 @@
14501451
<constraint firstAttribute="trailing" secondItem="Ueg-Bw-KU6" secondAttribute="trailing" id="nXh-Tu-veg"/>
14511452
</constraints>
14521453
</view>
1454+
<connections>
1455+
<outlet property="dismissButton" destination="Ueg-Bw-KU6" id="icp-fM-bz4"/>
1456+
</connections>
14531457
</viewController>
14541458
<placeholder placeholderIdentifier="IBFirstResponder" id="Rrd-X3-roK" userLabel="First Responder" sceneMemberID="firstResponder"/>
14551459
</objects>

WordPressAuthenticator/Signin/LoginPrologueLoginMethodViewController.swift

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ class LoginPrologueLoginMethodViewController: NUXViewController {
1313
open var selfHostedTapped: (() -> Void)?
1414
open var appleTapped: (() -> Void)?
1515

16+
/// The big transparent (dismiss) button behind the buttons
17+
@IBOutlet private weak var dismissButton: UIButton!
18+
1619
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
1720
super.prepare(for: segue, sender: sender)
1821

@@ -24,6 +27,7 @@ class LoginPrologueLoginMethodViewController: NUXViewController {
2427
override func viewDidLoad() {
2528
super.viewDidLoad()
2629
configureButtonVC()
30+
configureForAccessibility()
2731
}
2832

2933
override func viewWillAppear(_ animated: Bool) {
@@ -85,4 +89,23 @@ class LoginPrologueLoginMethodViewController: NUXViewController {
8589
appleTapped?()
8690
}
8791

92+
// MARK: - Accessibility
93+
94+
private func configureForAccessibility() {
95+
dismissButton.accessibilityLabel = NSLocalizedString("Dismiss", comment: "Accessibility label for the transparent space above the login dialog which acts as a button to dismiss the dialog.")
96+
97+
// Ensure that the first button (in buttonViewController) is automatically selected by
98+
// VoiceOver instead of the dismiss button.
99+
if buttonViewController?.isViewLoaded == true, let buttonsView = buttonViewController?.view {
100+
view.accessibilityElements = [
101+
buttonsView,
102+
dismissButton
103+
]
104+
}
105+
}
106+
107+
override func accessibilityPerformEscape() -> Bool {
108+
dismiss(animated: true)
109+
return true
110+
}
88111
}

WordPressAuthenticator/Signin/LoginPrologueSignupMethodViewController.swift

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ class LoginPrologueSignupMethodViewController: NUXViewController {
1414
open var googleTapped: (() -> Void)?
1515
open var appleTapped: (() -> Void)?
1616

17+
/// The big transparent (dismiss) button behind the buttons
18+
@IBOutlet private weak var dismissButton: UIButton!
19+
1720
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
1821
super.prepare(for: segue, sender: sender)
1922

@@ -25,6 +28,7 @@ class LoginPrologueSignupMethodViewController: NUXViewController {
2528
override func viewDidLoad() {
2629
super.viewDidLoad()
2730
configureButtonVC()
31+
configureForAccessibility()
2832
}
2933

3034
override func viewWillAppear(_ animated: Bool) {
@@ -82,8 +86,7 @@ class LoginPrologueSignupMethodViewController: NUXViewController {
8286
}
8387

8488
@IBAction func dismissTapped() {
85-
WordPressAuthenticator.track(.signupCancelled)
86-
dismiss(animated: true)
89+
trackCancellationAndThenDismiss()
8790
}
8891

8992
@objc func handleAppleButtonTapped() {
@@ -92,4 +95,29 @@ class LoginPrologueSignupMethodViewController: NUXViewController {
9295
dismiss(animated: true)
9396
appleTapped?()
9497
}
98+
99+
private func trackCancellationAndThenDismiss() {
100+
WordPressAuthenticator.track(.signupCancelled)
101+
dismiss(animated: true)
102+
}
103+
104+
// MARK: - Accessibility
105+
106+
private func configureForAccessibility() {
107+
dismissButton.accessibilityLabel = NSLocalizedString("Dismiss", comment: "Accessibility label for the transparent space above the signup dialog which acts as a button to dismiss the dialog.")
108+
109+
// Ensure that the first button (in buttonViewController) is automatically selected by
110+
// VoiceOver instead of the dismiss button.
111+
if buttonViewController?.isViewLoaded == true, let buttonsView = buttonViewController?.view {
112+
view.accessibilityElements = [
113+
buttonsView,
114+
dismissButton
115+
]
116+
}
117+
}
118+
119+
override func accessibilityPerformEscape() -> Bool {
120+
trackCancellationAndThenDismiss()
121+
return true
122+
}
95123
}

0 commit comments

Comments
 (0)