Skip to content
This repository has been archived by the owner on Jun 17, 2018. It is now read-only.

Add VoiceOver support to MenuView #374

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Pod/Classes/MenuView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ open class MenuView: UIScrollView {
internal init(menuOptions: MenuViewCustomizable) {
super.init(frame: CGRect(x: 0, y: 0, width: 0, height: menuOptions.height))

if #available(iOS 10.0, *) {
self.accessibilityTraits = UIAccessibilityTraitTabBar
}

self.menuOptions = menuOptions

commonInit({ self.constructMenuItemViews(menuOptions) })
Expand Down Expand Up @@ -121,9 +125,12 @@ open class MenuView: UIScrollView {

if let previousMenuItemView = previousMenuItemView,
page != previousPage {
previousMenuItemView.titleLabel.accessibilityTraits = UIAccessibilityTraitStaticText
onMove?(.willMoveItem(to: menuItemView, from: previousMenuItemView))
}

menuItemView.titleLabel.accessibilityTraits = UIAccessibilityTraitSelected

update(currentPage: page)

let duration = animated ? menuOptions.animationDuration : 0
Expand Down