Skip to content

Commit

Permalink
added accessibility traits
Browse files Browse the repository at this point in the history
  • Loading branch information
noorhashem committed Jul 7, 2020
1 parent 0f4eb54 commit 8b767e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions Extensions/Today/TodayUX.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ struct TodayStrings {
static let NewPrivateTabButtonLabel = NSLocalizedString("TodayWidget.NewPrivateTabButtonLabel", tableName: "Today", value: "Private Search", comment: "New Private Tab button label")
static let NewTabButtonLabel = NSLocalizedString("TodayWidget.NewTabButtonLabel", tableName: "Today", value: "New Search", comment: "New Tab button label")
static let GoToCopiedLinkLabel = NSLocalizedString("TodayWidget.GoToCopiedLinkLabel", tableName: "Today", value: "Go to copied link", comment: "Go to link on clipboard")
static let CopiedLinkLabelFromPasteBoard = NSLocalizedString("TodayWidget.CopiedLinkLabelFromPasteBoard", tableName: "Today", value: "Copied Link from clipboard", comment: "Copied Link from clipboard displayed")
}
5 changes: 5 additions & 0 deletions Extensions/Today/TodayViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class TodayViewController: UIViewController, NCWidgetProviding, TodayWidgetAppea
let button = imageButton.button
button.setImage(UIImage(named: "search-button")?.withRenderingMode(.alwaysOriginal), for: .normal)
button.accessibilityLabel = TodayStrings.NewTabButtonLabel
button.accessibilityTraits = .button
let label = imageButton.label
label.textColor = TodayUX.labelColor
label.tintColor = TodayUX.labelColor
Expand All @@ -38,6 +39,7 @@ class TodayViewController: UIViewController, NCWidgetProviding, TodayWidgetAppea
let button = imageButton.button
button.setImage(UIImage(named: "private-search")?.withRenderingMode(.alwaysOriginal), for: .normal)
button.accessibilityLabel = TodayStrings.NewPrivateTabButtonLabel
button.accessibilityTraits = .button
let label = imageButton.label
label.textColor = TodayUX.labelColor
label.tintColor = TodayUX.labelColor
Expand All @@ -56,12 +58,15 @@ class TodayViewController: UIViewController, NCWidgetProviding, TodayWidgetAppea
button.setImage(UIImage(named: "copy_link_icon")?.withRenderingMode(.alwaysOriginal), for: .normal)
button.label.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: UIFont.preferredFont(forTextStyle: .body).withSize(TodayUX.labelTextSize))
button.accessibilityLabel = TodayStrings.GoToCopiedLinkLabel
button.accessibilityTraits = .button
button.label.textColor = TodayUX.labelColor
button.label.tintColor = TodayUX.labelColor
button.label.sizeToFit()
button.subtitleLabel.textColor = TodayUX.subtitleLabelColor
button.subtitleLabel.tintColor = TodayUX.subtitleLabelColor
button.subtitleLabel.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: UIFont.preferredFont(forTextStyle: .body).withSize(TodayUX.linkTextSize))
button.label.accessibilityLabel = TodayStrings.CopiedLinkLabelFromPasteBoard
button.accessibilityTraits = .none
return button
}()

Expand Down

0 comments on commit 8b767e0

Please sign in to comment.