Skip to content

Commit

Permalink
Merge pull request #1246 from wordpress-mobile/fix/more-button-access…
Browse files Browse the repository at this point in the history
…ibility

Improve “More” button accessibility
  • Loading branch information
shiki authored Dec 11, 2019
2 parents c376a3a + 6e64f0d commit 4237063
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions Aztec/Classes/GUI/FormatBar/FormatBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ open class FormatBar: UIView {
let item = FormatBarItem(image: UIImage(), identifier: nil)
self.configureStylesFor(item)

item.accessibilityLabel = NSLocalizedString("More", comment: "Accessibility label for the More button on formatting toolbar.")
item.addTarget(self, action: #selector(handleToggleButtonAction), for: .touchUpInside)
item.addTarget(self, action: #selector(handleButtonTouch), for: .touchDown)

Expand Down Expand Up @@ -440,6 +441,7 @@ open class FormatBar: UIView {
rotateOverflowToggleItem(.vertical, animated: false)
}

updateOverflowToggleItemAccessibilityTraits(expanded: overflowVisible)
updateOverflowToggleItemVisibility()
}

Expand Down Expand Up @@ -527,6 +529,7 @@ open class FormatBar: UIView {
formatter?.formatBar(self, didChangeOverflowState: (shouldExpand) ? .visible : .hidden)

updateOverflowToggleItemRTLLayout(expand: shouldExpand, animated: true)
updateOverflowToggleItemAccessibilityTraits(expanded: shouldExpand)
}

private func setOverflowItemsVisible(_ visible: Bool, animated: Bool = true) {
Expand Down Expand Up @@ -859,6 +862,16 @@ extension FormatBar: UIScrollViewDelegate {
}
}

// MARK: - Accessibility

private extension FormatBar {
func updateOverflowToggleItemAccessibilityTraits(expanded: Bool) {
// We _could_ use overflowToggleItem.isSelected instead of modifying the traits. However,
// that would highlight the button with another color, which we don't need.
overflowToggleItem.accessibilityTraits = expanded ? [.button, .selected] : [.button]
}
}

// MARK: - Constants
extension FormatBar {
struct Constants {
Expand Down
2 changes: 1 addition & 1 deletion WordPress-Aztec-iOS.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'WordPress-Aztec-iOS'
s.version = '1.14.1'
s.version = '1.15.0-beta.1'
s.summary = 'The native HTML Editor.'

# This description is used to generate tags and improve search results.
Expand Down
2 changes: 1 addition & 1 deletion WordPress-Editor-iOS.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'WordPress-Editor-iOS'
s.version = '1.14.1'
s.version = '1.15.0-beta.1'
s.summary = 'The WordPress HTML Editor.'

# This description is used to generate tags and improve search results.
Expand Down

0 comments on commit 4237063

Please sign in to comment.