@@ -110,6 +110,7 @@ open class FormatBar: UIView {
110110 let item = FormatBarItem ( image: UIImage ( ) , identifier: nil )
111111 self . configureStylesFor ( item)
112112
113+ item. accessibilityLabel = NSLocalizedString ( " More " , comment: " Accessibility label for the More button on formatting toolbar. " )
113114 item. addTarget ( self , action: #selector( handleToggleButtonAction) , for: . touchUpInside)
114115 item. addTarget ( self , action: #selector( handleButtonTouch) , for: . touchDown)
115116
@@ -440,6 +441,7 @@ open class FormatBar: UIView {
440441 rotateOverflowToggleItem ( . vertical, animated: false )
441442 }
442443
444+ updateOverflowToggleItemAccessibilityTraits ( expanded: overflowVisible)
443445 updateOverflowToggleItemVisibility ( )
444446 }
445447
@@ -527,6 +529,7 @@ open class FormatBar: UIView {
527529 formatter? . formatBar ( self , didChangeOverflowState: ( shouldExpand) ? . visible : . hidden)
528530
529531 updateOverflowToggleItemRTLLayout ( expand: shouldExpand, animated: true )
532+ updateOverflowToggleItemAccessibilityTraits ( expanded: shouldExpand)
530533 }
531534
532535 private func setOverflowItemsVisible( _ visible: Bool , animated: Bool = true ) {
@@ -859,6 +862,16 @@ extension FormatBar: UIScrollViewDelegate {
859862 }
860863}
861864
865+ // MARK: - Accessibility
866+
867+ private extension FormatBar {
868+ func updateOverflowToggleItemAccessibilityTraits( expanded: Bool ) {
869+ // We _could_ use overflowToggleItem.isSelected instead of modifying the traits. However,
870+ // that would highlight the button with another color, which we don't need.
871+ overflowToggleItem. accessibilityTraits = expanded ? [ . button, . selected] : [ . button]
872+ }
873+ }
874+
862875// MARK: - Constants
863876extension FormatBar {
864877 struct Constants {
0 commit comments