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

Commit a5ba226

Browse files
authored
Add Accessbility identifier to passkeys button (#818)
2 parents c821438 + d287344 commit a5ba226

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

WordPressAuthenticator/Unified Auth/View Related/2FA/TwoFAViewController.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,9 @@ private extension TwoFAViewController {
556556
/// Configure the security key link cell.
557557
///
558558
func configureEnterSecurityKeyLinkButton(_ cell: TextLinkButtonTableViewCell) {
559-
cell.configureButton(text: WordPressAuthenticator.shared.displayStrings.securityKeyButtonTitle, icon: .keyIcon)
559+
cell.configureButton(text: WordPressAuthenticator.shared.displayStrings.securityKeyButtonTitle,
560+
icon: .keyIcon,
561+
accessibilityIdentifier: TextLinkButtonTableViewCell.Constants.passkeysID)
560562

561563
cell.actionHandler = { [weak self] in
562564
guard let self = self else { return }

WordPressAuthenticator/Unified Auth/View Related/Reusable Views/TextLinkButtonTableViewCell.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,19 @@ class TextLinkButtonTableViewCell: UITableViewCell {
2727
styleBorder()
2828
}
2929

30-
public func configureButton(text: String?, icon: UIImage? = nil, accessibilityTrait: UIAccessibilityTraits = .button, showBorder: Bool = false) {
30+
public func configureButton(text: String?,
31+
icon: UIImage? = nil,
32+
accessibilityTrait: UIAccessibilityTraits = .button,
33+
showBorder: Bool = false,
34+
accessibilityIdentifier: String? = nil) {
3135
button.setTitle(text, for: .normal)
3236

3337
let buttonTitleColor = WordPressAuthenticator.shared.unifiedStyle?.textButtonColor ?? WordPressAuthenticator.shared.style.textButtonColor
3438
let buttonHighlightColor = WordPressAuthenticator.shared.unifiedStyle?.textButtonHighlightColor ?? WordPressAuthenticator.shared.style.textButtonHighlightColor
3539
button.setTitleColor(buttonTitleColor, for: .normal)
3640
button.setTitleColor(buttonHighlightColor, for: .highlighted)
3741
button.accessibilityTraits = accessibilityTrait
42+
button.accessibilityIdentifier = accessibilityIdentifier
3843

3944
borderView.isHidden = !showBorder
4045

@@ -62,3 +67,10 @@ private extension TextLinkButtonTableViewCell {
6267
borderWidth.constant = WPStyleGuide.hairlineBorderWidth
6368
}
6469
}
70+
71+
// MARK: - Constants
72+
extension TextLinkButtonTableViewCell {
73+
struct Constants {
74+
static let passkeysID = "Passkeys"
75+
}
76+
}

0 commit comments

Comments
 (0)