forked from zelo72/mastodon-ios
feat: patch some VoiceOver issues. #309
This commit is contained in:
parent
7859ebd4ff
commit
079792784c
|
@ -7,12 +7,12 @@
|
|||
<key>AppShared.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>47</integer>
|
||||
<integer>37</integer>
|
||||
</dict>
|
||||
<key>CoreDataStack.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>46</integer>
|
||||
<integer>36</integer>
|
||||
</dict>
|
||||
<key>Mastodon - ASDK.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
|
@ -102,7 +102,7 @@
|
|||
<key>MastodonIntent.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>45</integer>
|
||||
<integer>38</integer>
|
||||
</dict>
|
||||
<key>MastodonIntents.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
|
@ -122,7 +122,7 @@
|
|||
<key>ShareActionExtension.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>48</integer>
|
||||
<integer>39</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
|
|
|
@ -45,6 +45,8 @@ extension NotificationSection {
|
|||
attribute: attribute
|
||||
)
|
||||
cell.delegate = delegate
|
||||
cell.isAccessibilityElement = true
|
||||
NotificationSection.configureStatusAccessibilityLabel(cell: cell)
|
||||
return cell
|
||||
|
||||
case .notificationStatus(objectID: let objectID, attribute: let attribute):
|
||||
|
@ -215,4 +217,30 @@ extension NotificationSection {
|
|||
cell.containerStackViewBottomLayoutConstraint.constant = 5 // 5pt margin when no status view
|
||||
}
|
||||
}
|
||||
|
||||
static func configureStatusAccessibilityLabel(cell: NotificationStatusTableViewCell) {
|
||||
// FIXME:
|
||||
cell.accessibilityLabel = {
|
||||
var accessibilityViews: [UIView?] = []
|
||||
accessibilityViews.append(contentsOf: [
|
||||
cell.titleLabel,
|
||||
cell.timestampLabel,
|
||||
cell.statusView
|
||||
])
|
||||
if !cell.statusContainerView.isHidden {
|
||||
if !cell.statusView.headerContainerView.isHidden {
|
||||
accessibilityViews.append(cell.statusView.headerInfoLabel)
|
||||
}
|
||||
accessibilityViews.append(contentsOf: [
|
||||
cell.statusView.nameMetaLabel,
|
||||
cell.statusView.dateLabel,
|
||||
cell.statusView.contentMetaText.textView,
|
||||
])
|
||||
}
|
||||
return accessibilityViews
|
||||
.compactMap { $0?.accessibilityLabel }
|
||||
.joined(separator: " ")
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,15 @@ extension PollSection {
|
|||
managedObjectContext.performAndWait {
|
||||
let option = managedObjectContext.object(with: objectID) as! PollOption
|
||||
PollSection.configure(cell: cell, pollOption: option, pollItemAttribute: attribute)
|
||||
|
||||
cell.isAccessibilityElement = true
|
||||
cell.accessibilityLabel = {
|
||||
var labels: [String] = [option.title]
|
||||
if let percentage = cell.pollOptionView.optionPercentageLabel.text {
|
||||
labels.append(percentage)
|
||||
}
|
||||
return labels.joined(separator: ",")
|
||||
}()
|
||||
}
|
||||
return cell
|
||||
}
|
||||
|
|
|
@ -158,6 +158,11 @@ extension StatusSection {
|
|||
accessibilityElements.append(cell.statusView.avatarView)
|
||||
accessibilityElements.append(cell.statusView.nameMetaLabel)
|
||||
accessibilityElements.append(cell.statusView.dateLabel)
|
||||
// poll
|
||||
accessibilityElements.append(cell.statusView.pollTableView)
|
||||
accessibilityElements.append(cell.statusView.pollVoteCountLabel)
|
||||
accessibilityElements.append(cell.statusView.pollCountdownLabel)
|
||||
accessibilityElements.append(cell.statusView.pollVoteButton)
|
||||
// TODO: a11y
|
||||
accessibilityElements.append(cell.statusView.contentMetaText.textView)
|
||||
accessibilityElements.append(contentsOf: cell.statusView.statusMosaicImageViewContainer.imageViews)
|
||||
|
@ -389,7 +394,7 @@ extension StatusSection {
|
|||
// set timestamp
|
||||
let createdAt = (status.reblog ?? status).createdAt
|
||||
cell.statusView.dateLabel.text = createdAt.localizedSlowedTimeAgoSinceNow
|
||||
cell.statusView.dateLabel.accessibilityValue = createdAt.timeAgoSinceNow
|
||||
cell.statusView.dateLabel.accessibilityLabel = createdAt.timeAgoSinceNow
|
||||
AppContext.shared.timestampUpdatePublisher
|
||||
.receive(on: RunLoop.main) // will be paused when scrolling (on purpose)
|
||||
.sink { [weak cell] _ in
|
||||
|
@ -978,6 +983,7 @@ extension StatusSection {
|
|||
cell.statusView.pollCountdownLabel.text = "-"
|
||||
}
|
||||
|
||||
cell.statusView.isUserInteractionEnabled = !poll.expired // make voice over touch passthroughable
|
||||
cell.statusView.pollTableView.allowsSelection = !poll.expired
|
||||
|
||||
let votedOptions = poll.options.filter { option in
|
||||
|
|
Loading…
Reference in New Issue