Skip to content

Commit d2793d9

Browse files
committed
Add .selected trait for More button if necessary
We _could_ use overflowToggleItem.isSelected instead of modifying the traits. However, that would highlight the button with another color, which we don't need. In here, the additional `.selected` trait is just so VoiceOver users can easily identify whether the Format bar has already been expanded.
1 parent 81c9d2e commit d2793d9

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Aztec/Classes/GUI/FormatBar/FormatBar.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ open class FormatBar: UIView {
440440
rotateOverflowToggleItem(.vertical, animated: false)
441441
}
442442

443+
updateOverflowToggleItemAccessibilityTraits(expanded: overflowVisible)
443444
updateOverflowToggleItemVisibility()
444445
}
445446

@@ -527,6 +528,7 @@ open class FormatBar: UIView {
527528
formatter?.formatBar(self, didChangeOverflowState: (shouldExpand) ? .visible : .hidden)
528529

529530
updateOverflowToggleItemRTLLayout(expand: shouldExpand, animated: true)
531+
updateOverflowToggleItemAccessibilityTraits(expanded: shouldExpand)
530532
}
531533

532534
private func setOverflowItemsVisible(_ visible: Bool, animated: Bool = true) {
@@ -872,6 +874,12 @@ extension FormatBar {
872874
return overflowToggleItem.accessibilityLabel
873875
}
874876
}
877+
878+
private func updateOverflowToggleItemAccessibilityTraits(expanded: Bool) {
879+
// We _could_ use overflowToggleItem.isSelected instead of modifying the traits. However,
880+
// that would highlight the button with another color, which we don't need.
881+
overflowToggleItem.accessibilityTraits = expanded ? [.button, .selected] : [.button]
882+
}
875883
}
876884

877885
// MARK: - Constants

0 commit comments

Comments
 (0)