Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
Accessibility improvements of Edit Profile screen (#1180)
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedbashir committed Dec 7, 2018
1 parent ae8069c commit d6574b2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions Source/IconButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,9 @@ class IconButton : UIControl {
disabledAttributedString = disabledTitleStyle.attributedString(withText: title)
titleLabel.attributedText = isEnabled ? enabledAttributedString : disabledAttributedString
}

func setAccessibility(with trait: UIAccessibilityTraits, hint: String) {
titleLabel.accessibilityTraits = trait
titleLabel.accessibilityHint = hint
}
}
3 changes: 3 additions & 0 deletions Source/JSONFormBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ class JSONFormBuilder {
descriptionLabel.textAlignment = .natural
descriptionLabel.numberOfLines = 0
descriptionLabel.preferredMaxLayoutWidth = 200 //value doesn't seem to matter as long as it's small enough

typeControl.tintColor = OEXStyles.shared().primaryBaseColor()
typeControl.setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.white], for: UIControlState.selected)

titleLabel.snp.makeConstraints { make in
make.leading.equalTo(contentView.snp.leadingMargin)
Expand Down
2 changes: 1 addition & 1 deletion Source/ProfileBanner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ProfileBanner: UIView {
addSubview(changeButton)

changeButton.setIconAndTitle(icon: Icon.Camera, title: Strings.Profile.changePictureButton)
changeButton.accessibilityHint = Strings.Profile.changePictureAccessibilityHint
changeButton.setAccessibility(with: UIAccessibilityTraitButton, hint: Strings.Profile.changePictureAccessibilityHint)

changeButton.snp.makeConstraints { make in
make.centerY.equalTo(shortProfView)
Expand Down
2 changes: 1 addition & 1 deletion Source/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@
/* Button title for moving to the next unit in the course */
"PREVIOUS_UNIT" = "Previous Unit";
/* A10y hint for the change picture button. */
"PROFILE.CHANGE_PICTURE_ACCESSIBILITY_HINT" = "Upload a new profile picture.";
"PROFILE.CHANGE_PICTURE_ACCESSIBILITY_HINT" = "Double tap to change profile photo";
/* Change picture button text on edit profile screen. */
"PROFILE.CHANGE_PICTURE_BUTTON" = "Change";
/* Text for use a photo already in library for user profile photo alert */
Expand Down
2 changes: 1 addition & 1 deletion Source/es-419.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@
/* Button title for moving to the next unit in the course */
"PREVIOUS_UNIT" = "Unidad anterior";
/* A10y hint for the change picture button. */
"PROFILE.CHANGE_PICTURE_ACCESSIBILITY_HINT" = "Cargue una nueva foto de perfil";
"PROFILE.CHANGE_PICTURE_ACCESSIBILITY_HINT" = "Double tap to change profile photo";
/* Change picture button text on edit profile screen. */
"PROFILE.CHANGE_PICTURE_BUTTON" = "Cambiar";
/* Text for use a photo already in library for user profile photo alert */
Expand Down

0 comments on commit d6574b2

Please sign in to comment.