Add accessibility labels to bar button image items.

This commit is contained in:
Maurice Parker 2019-04-27 10:27:36 -05:00
parent 7127f9a911
commit 1730ffb0cc
3 changed files with 84 additions and 1 deletions

View File

@ -116,6 +116,7 @@
51F85BF32272531500C787DC /* Dedication.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 51F85BF22272531500C787DC /* Dedication.rtf */; };
51F85BF52273625800C787DC /* Bundle-Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51F85BF42273625800C787DC /* Bundle-Extensions.swift */; };
51F85BF722749FA100C787DC /* UIFont-Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51F85BF622749FA100C787DC /* UIFont-Extensions.swift */; };
51F85BF92274AA7B00C787DC /* UIBarButtonItem-Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51F85BF82274AA7B00C787DC /* UIBarButtonItem-Extensions.swift */; };
6581C73820CED60100F4AD34 /* SafariExtensionHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6581C73720CED60100F4AD34 /* SafariExtensionHandler.swift */; };
6581C73A20CED60100F4AD34 /* SafariExtensionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6581C73920CED60100F4AD34 /* SafariExtensionViewController.swift */; };
6581C73D20CED60100F4AD34 /* SafariExtensionViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6581C73B20CED60100F4AD34 /* SafariExtensionViewController.xib */; };
@ -670,6 +671,7 @@
51F85BF22272531500C787DC /* Dedication.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = Dedication.rtf; sourceTree = "<group>"; };
51F85BF42273625800C787DC /* Bundle-Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Bundle-Extensions.swift"; sourceTree = "<group>"; };
51F85BF622749FA100C787DC /* UIFont-Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIFont-Extensions.swift"; sourceTree = "<group>"; };
51F85BF82274AA7B00C787DC /* UIBarButtonItem-Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIBarButtonItem-Extensions.swift"; sourceTree = "<group>"; };
6581C73320CED60000F4AD34 /* Subscribe to Feed.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Subscribe to Feed.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
6581C73420CED60100F4AD34 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
6581C73720CED60100F4AD34 /* SafariExtensionHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariExtensionHandler.swift; sourceTree = "<group>"; };
@ -974,10 +976,11 @@
5183CCD9226E31A50010922C /* NonIntrinsicImageView.swift */,
5183CCCF226E1E880010922C /* NonIntrinsicLabel.swift */,
51C45250226506F400C03939 /* String-Extensions.swift */,
51F85BF82274AA7B00C787DC /* UIBarButtonItem-Extensions.swift */,
51F85BF622749FA100C787DC /* UIFont-Extensions.swift */,
51C4524F226506F400C03939 /* UIImage-Extensions.swift */,
51C4524E226506F400C03939 /* UIStoryboard-Extensions.swift */,
512E092B2268B25500BDCFDD /* UISplitViewController-Extensions.swift */,
51F85BF622749FA100C787DC /* UIFont-Extensions.swift */,
);
path = Extensions;
sourceTree = "<group>";
@ -2223,6 +2226,7 @@
51C452A422650A2D00C03939 /* ArticleUtilities.swift in Sources */,
5183CCDA226E31A50010922C /* NonIntrinsicImageView.swift in Sources */,
51C4527B2265091600C03939 /* MasterUnreadIndicatorView.swift in Sources */,
51F85BF92274AA7B00C787DC /* UIBarButtonItem-Extensions.swift in Sources */,
51C45296226509D300C03939 /* OPMLExporter.swift in Sources */,
51C4525B226508DA00C03939 /* UIImage-Extensions.swift in Sources */,
84F3EE1720DEC97E003FADEB /* FeedFinder.swift in Sources */,

View File

@ -58,42 +58,68 @@
</view>
<toolbarItems>
<barButtonItem enabled="NO" image="nextUnreadImage" id="2w5-e9-C2V">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="accEnabled" value="YES"/>
<userDefinedRuntimeAttribute type="string" keyPath="accLabelText" value="Next Unread"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="nextUnread:" destination="JEX-9P-axG" id="USD-hC-C6z"/>
</connections>
</barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="vAq-iW-Yyo"/>
<barButtonItem image="prevArticleImage" style="plain" id="v4j-fq-23N">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="accEnabled" value="YES"/>
<userDefinedRuntimeAttribute type="string" keyPath="accLabelText" value="Previous Article"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="prevArticle:" destination="JEX-9P-axG" id="cMZ-tk-I4W"/>
</connections>
</barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="G92-nw-kXs"/>
<barButtonItem image="nextArticleImage" id="2qz-M5-Yhk">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="accEnabled" value="YES"/>
<userDefinedRuntimeAttribute type="string" keyPath="accLabelText" value="Next Article"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="nextArticle:" destination="JEX-9P-axG" id="P77-KM-j8D"/>
</connections>
</barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="Myj-ux-Zc5"/>
<barButtonItem image="circleOpenImage" id="hy0-LS-MzE">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="accLabelText" value="Toggle Mark as Read"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="toggleRead:" destination="JEX-9P-axG" id="A8V-r1-o9u"/>
</connections>
</barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="n8Q-7d-yb4"/>
<barButtonItem image="starOpenImage" id="wU4-eH-wC9">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="accLabelText" value="Toggle Mark as Starred"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="toggleStar:" destination="JEX-9P-axG" id="4Mp-Ir-N5v"/>
</connections>
</barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="bf9-AH-def"/>
<barButtonItem systemItem="action" id="9Ut-5B-JKP">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="accEnabled" value="YES"/>
<userDefinedRuntimeAttribute type="string" keyPath="accLabelText" value="Share"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="showActivityDialog:" destination="JEX-9P-axG" id="t7U-uT-fs5"/>
</connections>
</barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="KUq-GZ-WY9"/>
<barButtonItem image="browserImage" id="DMh-3X-ebd">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="accEnabled" value="YES"/>
<userDefinedRuntimeAttribute type="string" keyPath="accLabelText" value="Open In Safari"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="openBrowser:" destination="JEX-9P-axG" id="R0r-fI-NI7"/>
</connections>
@ -232,6 +258,9 @@
</barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="ePD-cM-h2y"/>
<barButtonItem systemItem="add" id="yo6-w4-SfI">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="accLabelText" value="Add Feed or Folder"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="add:" destination="7bK-jq-Zjz" id="k61-ub-SdZ"/>
</connections>
@ -239,6 +268,10 @@
</toolbarItems>
<navigationItem key="navigationItem" title="Feeds" id="Zdf-7t-Un8">
<barButtonItem key="leftBarButtonItem" image="settingsImage" id="2lM-3y-hKs">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="accEnabled" value="YES"/>
<userDefinedRuntimeAttribute type="string" keyPath="accLabelText" value="Settings"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="settings:" destination="7bK-jq-Zjz" id="keC-la-uyI"/>
</connections>

View File

@ -0,0 +1,46 @@
//
// UIBarButtonItem-Extensions.swift
// NetNewsWire-iOS
//
// Created by Maurice Parker on 4/27/19.
// Copyright © 2019 Ranchero Software. All rights reserved.
//
import UIKit
public extension UIBarButtonItem {
@IBInspectable var accEnabled: Bool {
get {
return isAccessibilityElement
}
set {
isAccessibilityElement = newValue
}
}
@IBInspectable var accLabelText: String? {
get {
return accessibilityLabel
}
set {
accessibilityLabel = newValue
}
}
var isHidden: Bool {
get {
return tintColor == UIColor.clear
}
set(hide) {
if hide {
isEnabled = false
tintColor = UIColor.clear
} else {
isEnabled = true
tintColor = nil
}
}
}
}