Skip to content

Commit

Permalink
Bugfix FXIOS-8948 Fix toolbar a11y labels (#22234)
Browse files Browse the repository at this point in the history
  • Loading branch information
MattLichtenstein authored Sep 27, 2024
1 parent 0588803 commit c5fdff8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class PrivateModeButton: ToggleButton, PrivateModeUI {
override init(frame: CGRect) {
super.init(frame: frame)
accessibilityLabel = .TabTrayToggleAccessibilityLabel
accessibilityHint = .TabTrayToggleAccessibilityHint
let maskImage = UIImage(named: StandardImageIdentifiers.Large.privateMode)?
.withRenderingMode(.alwaysTemplate)
setImage(maskImage, for: [])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class AddressToolbarContainerModel: Equatable {
let browserActions: [ToolbarElement]

let borderPosition: AddressToolbarBorderPosition?
let searchEngineName: String?
let searchEngineImage: UIImage?
let searchEngines: SearchEngines
let lockIconImageName: String?
Expand All @@ -31,9 +32,12 @@ class AddressToolbarContainerModel: Equatable {

let locationViewState = LocationViewState(
searchEngineImageViewA11yId: AccessibilityIdentifiers.Browser.AddressToolbar.searchEngine,
searchEngineImageViewA11yLabel: .AddressToolbar.PrivacyAndSecuritySettingsA11yLabel,
searchEngineImageViewA11yLabel: String(
format: .AddressToolbar.SearchEngineA11yLabel,
searchEngineName ?? ""
),
lockIconButtonA11yId: AccessibilityIdentifiers.Browser.AddressToolbar.lockIcon,
lockIconButtonA11yLabel: .AddressToolbar.SearchEngineA11yLabel,
lockIconButtonA11yLabel: .AddressToolbar.PrivacyAndSecuritySettingsA11yLabel,
urlTextFieldPlaceholder: .AddressToolbar.LocationPlaceholder,
urlTextFieldA11yId: AccessibilityIdentifiers.Browser.AddressToolbar.searchTextField,
urlTextFieldA11yLabel: .AddressToolbar.LocationA11yLabel,
Expand Down Expand Up @@ -79,6 +83,7 @@ class AddressToolbarContainerModel: Equatable {
isShowingTopTabs: state.isShowingTopTabs,
windowUUID: windowUUID)
self.windowUUID = windowUUID
self.searchEngineName = profile.searchEngines.defaultEngine?.shortName
self.searchEngineImage = profile.searchEngines.defaultEngine?.image
self.searchEngines = profile.searchEngines
self.lockIconImageName = state.addressToolbar.lockIconImageName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class HomepageHeaderCell: UICollectionViewCell, ReusableCell, ThemeApplicable {
button.layer.cornerRadius = button.frame.size.width / 2
button.addTarget(self, action: #selector(self?.switchMode), for: .touchUpInside)
button.accessibilityLabel = .TabTrayToggleAccessibilityLabel
button.accessibilityHint = .TabTrayToggleAccessibilityHint
button.accessibilityIdentifier = AccessibilityIdentifiers.FirefoxHomepage.OtherButtons.privateModeToggleButton
}

Expand Down Expand Up @@ -115,5 +114,8 @@ class HomepageHeaderCell: UICollectionViewCell, ReusableCell, ThemeApplicable {
let privateModeButtonTintColor = viewModel.isPrivate ? theme.colors.layer2 : theme.colors.iconPrimary
privateModeButton.imageView?.tintColor = privateModeButtonTintColor
privateModeButton.backgroundColor = viewModel.isPrivate ? .white : .clear
privateModeButton.accessibilityValue = viewModel.isPrivate ?
.TabTrayToggleAccessibilityValueOn :
.TabTrayToggleAccessibilityValueOff
}
}
10 changes: 5 additions & 5 deletions firefox-ios/Client/Frontend/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6371,11 +6371,6 @@ extension String {
tableName: "PrivateBrowsing",
value: "Private browsing",
comment: "Accessibility label for toggling on/off private mode")
public static let TabTrayToggleAccessibilityHint = MZLocalizedString(
key: "Turns private mode on or off",
tableName: "PrivateBrowsing",
value: nil,
comment: "Accessiblity hint for toggling on/off private mode")
public static let TabTrayToggleAccessibilityValueOn = MZLocalizedString(
key: "On",
tableName: "PrivateBrowsing",
Expand Down Expand Up @@ -7393,6 +7388,11 @@ extension String {
tableName: "PrivateBrowsing",
value: nil,
comment: "Accessibility label for toggling on/off private mode")
public static let TabTrayToggleAccessibilityHint = MZLocalizedString(
key: "Turns private mode on or off",
tableName: "PrivateBrowsing",
value: nil,
comment: "Accessiblity hint for toggling on/off private mode")
}
}
}
Expand Down

0 comments on commit c5fdff8

Please sign in to comment.