Sfoglia il codice sorgente

Fix share a11y

- don't expose hidden textfield
- add bool values for ToggleCells
- add show profile hint & action
- add button labels
- add quick permission hint

Signed-off-by: Henrik Storch <henrik.storch@nextcloud.com>
Henrik Storch 2 anni fa
parent
commit
c7ff00daaf

+ 1 - 1
iOSClient/Extensions/UIApplication+Orientation.swift

@@ -20,7 +20,7 @@
 //  You should have received a copy of the GNU General Public License
 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //
-import Foundation
+import UIKit
 
 extension UIApplication {
     // indicates if current device is in landscape orientation

+ 1 - 0
iOSClient/Menu/NCMenu+FloatingPanel.swift

@@ -23,6 +23,7 @@
 
 import Foundation
 import FloatingPanel
+import UIKit
 
 class NCMenuFloatingPanelLayout: FloatingPanelLayout {
     var position: FloatingPanelPosition = .bottom

+ 4 - 0
iOSClient/Share/Advanced/NCShareCells.swift

@@ -243,6 +243,8 @@ class NCShareToggleCell: UITableViewCell {
     typealias CustomToggleIcon = (onIconName: String?, offIconName: String?)
     init(isOn: Bool, customIcons: CustomToggleIcon? = nil) {
         super.init(style: .default, reuseIdentifier: "toggleCell")
+        self.accessibilityValue = isOn ? NSLocalizedString("_on_", comment: "") : NSLocalizedString("_off_", comment: "")
+
         guard let customIcons = customIcons,
               let iconName = isOn ? customIcons.onIconName : customIcons.offIconName else {
             self.accessoryType = isOn ? .checkmark : .none
@@ -286,6 +288,8 @@ class NCShareDateCell: UITableViewCell {
             self.onReload?()
         }
 
+        textField.isAccessibilityElement = false
+        textField.accessibilityElementsHidden = true
         textField.inputAccessoryView = toolbar.wrappedSafeAreaContainer
         textField.inputView = picker
 

+ 2 - 0
iOSClient/Share/NCShare.swift

@@ -128,6 +128,8 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent
             for: metadata.ownerId,
             displayName: metadata.ownerDisplayName,
             userBaseUrl: appDelegate)
+        sharedWithYouByLabel.accessibilityHint = NSLocalizedString("_show_profile_", comment: "")
+
         let shareAction = UITapGestureRecognizer(target: self, action: #selector(openShareProfile))
         sharedWithYouByImage.addGestureRecognizer(shareAction)
         let shareLabelAction = UITapGestureRecognizer(target: self, action: #selector(openShareProfile))

+ 3 - 0
iOSClient/Share/NCShareLinkCell.swift

@@ -48,6 +48,8 @@ class NCShareLinkCell: UITableViewCell {
         menuButton.isHidden = isInternalLink
         descriptionLabel.isHidden = !isInternalLink
         copyButton.isHidden = !isInternalLink && tableShare == nil
+        copyButton.accessibilityLabel = NSLocalizedString("_copy_", comment: "")
+        menuButton.accessibilityLabel = NSLocalizedString("_more_", comment: "")
 
         if isInternalLink {
             imageName = "shareInternalLink"
@@ -62,6 +64,7 @@ class NCShareLinkCell: UITableViewCell {
                 }
             } else {
                 menuImageName = "shareAdd"
+                menuButton.accessibilityLabel = NSLocalizedString("_add_", comment: "")
             }
 
             imageName = "sharebylink"

+ 6 - 0
iOSClient/Share/NCShareUserCell.swift

@@ -47,6 +47,10 @@ class NCShareUserCell: UITableViewCell, NCCellProtocol {
         guard let tableShare = tableShare else {
             return
         }
+        self.accessibilityCustomActions = [UIAccessibilityCustomAction(
+            name: NSLocalizedString("_show_profile_", comment: ""),
+            target: self,
+            selector: #selector(tapAvatarImage))]
 
         labelTitle.text = tableShare.shareWithDisplayname
         labelTitle.textColor = NCBrandColor.shared.label
@@ -54,6 +58,7 @@ class NCShareUserCell: UITableViewCell, NCCellProtocol {
         labelQuickStatus.isHidden = false
         imageDownArrow.isHidden = false
         buttonMenu.isHidden = false
+        buttonMenu.accessibilityLabel = NSLocalizedString("_more_", comment: "")
         imageItem.image = NCShareCommon.shared.getImageShareType(shareType: tableShare.shareType)
 
         let status = NCUtility.shared.getUserStatus(userIcon: tableShare.userIcon, userStatus: tableShare.userStatus, userMessage: tableShare.userMessage)
@@ -68,6 +73,7 @@ class NCShareUserCell: UITableViewCell, NCCellProtocol {
             buttonMenu.isHidden = true
         }
 
+        btnQuickStatus.accessibilityHint = NSLocalizedString("_user_sharee_footer_", comment: "")
         btnQuickStatus.setTitle("", for: .normal)
         btnQuickStatus.contentHorizontalAlignment = .left
 

+ 8 - 3
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -868,6 +868,11 @@
 // MARK: Accessibility
 
 // Accessibility, floating panel top element
-"_cart_controller_"           = "Cart controller";
-"_accessibility_add_upload_" = "Add and upload";
-"_dismiss_menu_"              = "Dismiss the menu";
+"_cart_controller_"             = "Cart controller";
+"_accessibility_add_upload_"    = "Add and upload";
+"_dismiss_menu_"                = "Dismiss the menu";
+"_show_profile_"                = "Show profile";
+// a11y: On/Off
+"_on_"                          = "On";
+// a11y: On/Off
+"_off_"                         = "Off";